diff options
author | Bernardo Meurer <bernardo@meurer.org> | 2022-04-25 16:17:21 -0700 |
---|---|---|
committer | Bernardo Meurer <bernardo@meurer.org> | 2022-11-15 11:45:20 -0500 |
commit | 6382598677548d5b483dce4ab380067cd91af6d2 (patch) | |
tree | 8124a6131f90d244e0fa464a6d807375b0c31588 /pkgs/build-support | |
parent | ea5dd5d6affb9d70071c09e8e18e6afbb15635a8 (diff) |
linkFarm: make last entry win in case of list repeats
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/trivial-builders.nix | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index f29027aa1c68e..39c5787e38231 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -489,7 +489,8 @@ rec { let entries' = if (lib.isAttrs entries) then entries - else if (lib.isList entries) then lib.listToAttrs (map (x: lib.nameValuePair x.name x.path) entries) + # We do this foldl to have last-wins semantics in case of repeated entries + else if (lib.isList entries) then lib.foldl (a: b: a // { "${b.name}" = b.path; }) { } entries else throw "linkFarm entries must be either attrs or a list!"; linkCommands = lib.mapAttrsToList (name: path: '' |