I’m using Nix as a package manager on macOS. When I run nix-env -i -A nixpkgs.curl, the only Curl files that are “installed” in ~/.nix-profile are the binary and the man pages. I would like the zsh completion script (located in $out/share/zsh/site-functions) to be installed too. There are already several copies of this script in the Nix store, e.g.
How can I tell Nix that I want this path to be linked into my ~/.nix-profile?
Curl is a multiple-output derivation, so it seems like maybe I want to install the “out” output, but I’m not sure what that would look like using nix-env. I could add an override for curl to my config.nix if necessary.
If you run nix edit nixpkgs.curl, it’ll take you to the curl derivation file in your $EDITOR, which shows that curl is a split-output package with the following installable packages:
outputs = [ "bin" "dev" "out" "man" "devdoc" ];
You can then take a look at them and see what each one has:
λ brh nixpkgs → tree $(nix-build -A curl.bin)
/nix/store/fcjz6ganvyz3q1ayav32rk0qdixa8ydr-curl-7.68.0-bin
└── bin
└── curl
1 directory, 1 file
Thanks for the reply! I tried nix-env -i -A nixpkgs.curl.out (I had to add the -A flag) but I still don’t see those files linked into ~/.nix-profile/share. Oddly, even if I run
nix-env -e curl
nix-env -i -A nixpkgs.curl.out
the Curl binary is still linked in to ~/.nix-profile/bin but the files under ~/.nix-profile/share are not there. Is nix-env only pretending that it understands multiple-output derivations?