This is likely to be me once again missing it in the docs (and if so, I apologize), but:
What is the supported way to set NIX_PATH to a custom location? I like to use a clone of the nixpkgs repo rather than a channel. Is there something in a nix.conf or config.nix that will do this?
So far I’m just modifying my /etc/bashrc to clobber the already-set NIX_PATH to point to /nix.
Thanks for the info, guys! It sounds like what I’m doing is about as correct as it gets. I just wanted to make sure there was no other source of truth that any of the tools might have been consulting that would lead to some sort of conflict/inconsistency.
@costrouc, I didn’t know about pkgs.mkShell, thanks! That looks like an interesting (although, undocumented?) feature. With nix-shell so far, I’ve just been using regular old derivations, which seems to work ok for me. mkShellsounds like it’s designed for this though… Can you tell me how it is different?
@qoli I am somewhat new to nix so take what I say with a grain of salt (been using for 2 months). Using pkgs.mkShell is the correct way to instantiate a nix-shell. If you look at the definition nixpkgs/default.nix at master · NixOS/nixpkgs · GitHub you will see that it is a normal mkDerivation that will not allow building ( see nobuildPhase ). I will admit that it is not documented well enough and I too originally used mkDerivation. mkShell has two useful variables buildInputs: specify all packages that should be made available in environment, shellHook: run arbitrary bash script before entering environment. As an example
For the record, there is a smallish documentation segment about mkShell intended to be added to the Nixpkgs manual, but it looks like something broke the integration of .md files into the documentation, or it never fully worked.