hi everyone!! another daft question from a daft noob here.
ive seen so many people do it in their configs (which really bothers me, sorry, or maybe i dont know something?), uhm, and so there was already a post about this:
however, if the programs.*.package is set differently:
who wins? which firefox will actually open? or will there be two browsers, unlike with the git example above? that is, looking at the Programs provided section on search.nixos.org, they have the same binary name, right? but what happens to the other one? how do i run a specific binary, when they are the same?
There may not be a stable sort order across all nixpkgs and nixos-config combos (but anyone feel free to correct me if wrong). For shell.nix, the order of nativeBuildInputs sets precedence (which can be important for getting a nicely packaged language server from either of clang vs clang-tools), so I wouldn’t be surprised if environment.systemPackages was the same way. At the end of the day, most programs.*.enable are adding something to systemPackages while also setting other settings/services/files.
In a more concrete way, you can tell which one is being called by using which firefox and see possible options within the PATH with whereis firefox. You may need to us ls -l or readlink to resolve ultimately to a /nix/store path.
error: builder for '/nix/store/6bj6cw18bf8h3v3r5skpgj6qhxznrykp-home-manager-path.drv' fail…
last 1 log lines:
> error: collision between `/nix/store/gxcvll563w981wh82bnjhvqpa45z2nag-nh-4.2.0/bin…
For full logs, run:
nix log /nix/store/6bj6cw18bf8h3v3r5skpgj6qhxznrykp-home-manager-path.drv
If you add the package to the same option the module would add it to, and it’s literally identical, it should be silently deduplicated. If it’s not identical, the build will fail with a collision when trying to synthesize the linkfarm.
If you add the package to a different option (such as users.users.<name>.packages), it may go into a different entry in PATH and you can determine which one takes precedence by the PATH order.
but what if, HYPOTHETICALLY, they get in and it compiles successfully? what should one do? or is it hard to imagine, perhaps such scenario is literally impossible?
thank you all!
P.S. haha, to clarify, no, i dont have this problem (yet)
The derivation that combines the packages into a single tree of symlinks always fails if multiple of the packages provide the same file. So there’s really no way for there to ever be a conflict like you’re imagining.