Let say I install git
with nix-env
Is there an elegant way to say “I only want the git binary”? Or should I start working on a tool that does it
Let say I install git
with nix-env
Is there an elegant way to say “I only want the git binary”? Or should I start working on a tool that does it
You could create a derivation which only symblinks git to $out/bin/git, then install that “wrapper” derivation, this way nix-env would install only the git binary
Take into account that you would still have all the binaries in your /nix/store, but not in your profile as you asked
Thanks. And yeah, I actually definitely want all them in /nix/store, just not in my path.
Maybe I’ll attempt an automated version of what you mentioned.
I’ve had a few times with nix-shell where package A’s secondary binary (like the pwsh in this git) overrides the primary binary for package B that I explicitly added. Causes all types of horrible mismatches.
nixpkgs.linkFarm is all you need then:
nixpkgs.linkFarm "mygit" [
{
name = "bin/git";
path = nixpkgs.git;
}
]