Skip to content

Instantly share code, notes, and snippets.

@shajra
Created October 31, 2018 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shajra/2303b16db076df6b6954f9e326e39ac6 to your computer and use it in GitHub Desktop.
Save shajra/2303b16db076df6b6954f9e326e39ac6 to your computer and use it in GitHub Desktop.
Can someone explain how NIX_PATH works?
I understand how names are set explicitly on NIX_PATH:
$ NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos \
> nix eval nixpkgs.lib.version
"19.03pre155751.45a419ab5a2"
But this seems to indicate that raw paths can be put on NIX_PATH to override settings:
$ NIX_PATH=/home/tnks/.nix-defexpr/channels:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos \
> nix eval nixpkgs.lib.version
"19.03pre155767.8070a6333f3"
However, this only seems to work when overriding, not in isolation:
$ NIX_PATH=/home/tnks/.nix-defexpr/channels \
> nix eval nixpkgs.lib.version
error: attribute 'nixpkgs' in selection path 'nixpkgs.lib.version' not found
What is going on here?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment