Symlinks produced by `nix build` are in arbitrary order
Describe the bug
nix build creates symlinks with suffixes -1, -2, ... when given multiple installables, but not necessarily in an order corresponding to the order given on the cmdline
Steps To Reproduce
$ nix build nixpkgs#hello nixpkgs#cowsay
lrwxrwxrwx 55 sebastian 17 Dec 14:36 result -> /nix/store/3d54xbrqj5zixa0cfnyki09jrffr0g3a-cowsay-3.04
lrwxrwxrwx 56 sebastian 17 Dec 14:36 result-1 -> /nix/store/g2m8kfw7kpgpph05v2fxcx4d5an09hl3-hello-2.12.1
Expected behavior
result should be the result of the first given installable etc.
nix-env --version output
nix-env (Nix) 2.11.0
Priorities
Add :+1: to issues you find important.
Is the order really arbitrary or is it sorted by store path?
I think they are in fact sorted by derivation name (DerivationGoal::key more specifically), but that sounds still pretty arbitrary to me :)
Déjà vu
- https://github.com/NixOS/nix/pull/4257
Hi, is this issue still being tracked? I think at least the documentation should be changed to reflect the sorting order. Right now it states:
Each symlink has a suffix -<N>-
, where N is the index of the installable (with the left-most installable having index 0), and outname is the symbolic derivation output name (e.g. bin, dev or lib). -<N> is omitted if N = 0, and - is omitted if outname = out (denoting the default output).