-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to configure niv directory path #133
base: master
Are you sure you want to change the base?
Conversation
New NIV_DIR environment variable configures a path to a directory where niv will manage sources.{nix,json} files.
@nmattia Is there anything one can contribute to this to get it merged? :) |
Oh wow! Apologies, first time I see this PR, must have missed the notification! Would the |
Personally, I'd prefer the environment variable because I can ship that within a projects |
The main difference I guess would be that |
In #172 I asked for this same feature as a CLI option instead of an environment variable. I think I'd like to do both because the user gets better documentation with I may make a PR that implements both the env var and extra command-line switch. |
I just realized that import sources.nix { sourcesFile = PATH ; }; |
I'd really to have $ tree .config/
.config/
└── nix
├── shell.nix
├── sources.json
└── sources.nix
1 directory, 3 files When I use $ niv --sources-file .config/nix/sources.json update nixpkgs
Update nixpkgs
WARNING: Could not read nix/sources.nix
( nix/sources.nix: openBinaryFile: does not exist (No such file or directory) )
Done: Update nixpkgs I'm not sure what the downside of the warning is. I currently workaround with $ (cd .config && niv update nixpkgs)
Update nixpkgs
Done: Update nixpkgs |
@steshaw that's interesting, can you tell me more about the use case? Do you use niv globally, as opposed to per-project? |
ProjectsWith projects, I provision the [development] environment using direnv+nix+nix-direnv (though I used Lorri also for caching). In an example project export PROJECT_HOME=$PWD
nix_shell=$PROJECT_HOME/.config/nix/shell.nix
use nix "${nix_shell}"
watch_file "${nix_shell}"
PATH_add scripts The Being able to add export NIV_DIR=$PWD/.config/nix to my I wrote up an unpublished article about how I use XDG-style layout for projects. I still use this layout as much as possible today, though I've moved GlobalNot entirely sure what you mean by global but I have 2 candidates: global NixOS configuration and my user profile. I don't use Are you thinking that export NIV_DIR=~/Code/steshaw/shelly/nix/nix If I also used |
Then you may want to give https://github.com/nmattia/sorri a try! It's a work in progress but we already use it at $WORK.
Ok, that makes a lot of sense. I want to spend some time cleaning up #279 this week, I might as well add support for |
Thanks! I'll be sure to check out https://github.com/nmattia/sorri as well 😄 |
Thanks for sharing your work-around @steshaw! Addng DirEnv to the mix, this is loaded by adding Looking forward to when this PR is merge so that Niv mgmt will be more "normalized". Thanks! |
New NIV_DIR environment variable configures a path to a directory
where niv will manage sources.{nix,json} files.