I am on NixOS 16.09 and I want to use packages which are currently only in nixpkgs-unstable / nixos-unstable.
Using nix-channel --add
, I was able to add nixpkgs-unstable to my (user) channels and use it to install the latest version of some packages with nix-env
.
However, I understand that while nix-env
depends on user-defined channels, nix-shell
instead depends on the NIX_PATH
environment variable, in my case:
$ echo $NIX_PATH
nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels
So this clearly shows the problem: nix-shell
is going to use the system-wide NixOS 16.09 channel instead of the user-defined nixpkgs-unstable channel.
Right now, I am using this workaround:
nix-shell -I nixpkgs=~/.nix-defexpr/channels/nixpkgs
It does not look very pretty to me. What would be the recommended way of doing this?
Is it to add something like:
export NIX_PATH="nixpkgs=~/.nix-defexpr/channels/nixpkgs:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels"
to my .profile
? It does not look very pretty either.