I’m trying to add a package to linuxPackages_4_19 using overlays in NixOS 19.09.
My NIX_PATH: NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels:nixpkgs-overlays=/etc/nixos/overlays/
My /etc/nixos/overlays contains one file, parallels.nix, which looks like this:
also, nix-env has some odd behavior, and might not even be referencing your overlays, as I think it only references channels? (not actually sure, never use nix-env)
@jonringer, the sudo doesn’t matter in my case. I get the same results when logged in as root, as well.
If nix-env is unreliable (which btw is really frustrating–the docs simply state that setting up overlays the way that I’ve done will make overlays available to “all Nix tools”), what method do you recommend for me to do a one-off installation of an overlayed package?
sudo executes a command as root, so this makes sense. I was commenting on the difference between nix-env and sudo nix-env.
If nix-env is unreliable (which btw is really frustrating–the docs simply state that setting up overlays the way that I’ve done will make overlays available to “all Nix tools”), what method do you recommend for me to do a one-off installation of an overlayed package?
nix-env is differrent in a lot of regards (to emulate behavior of other package ecosystems, see my previous link). I think the “nix tools” is referring to the other tooling such as nix-build, and the 2.0 nix XXX commands.
nix-env should respect overlays. My first suggestion is to compare the output of nix eval '(<nixpkgs-overlays>)' and sudo nix eval '(<nixpkgs-overlays>)' to make sure both spit out the same path. sudo shouldn’t be changing the NIX_PATH var but this is just a sanity check.
Alright, so…based on the post that you quoted, @jonringer, and looking up the man page for nix-env, I was able to figure out that the -i option when used by itself seems to be using some sort of heuristic to find the correct derivation based on the name provided, whereas I was trying to pass a specific attribute path.
In other words, I believe that nix-env is now seeing the overlays when I use the -A option. I’ve fixed my problem, although I’m not precisely sure why it was happening.