linkFarm: add entries to passthru

This commit is contained in:
Bernardo Meurer 2022-04-23 21:04:34 -07:00
parent 248cf8aca4
commit b54257fb36
No known key found for this signature in database

View file

@ -475,14 +475,18 @@ rec {
*
* See the note on symlinkJoin for the difference between linkFarm and symlinkJoin.
*/
linkFarm = name: entries: runCommand name { preferLocalBuild = true; allowSubstitutes = false; }
''mkdir -p $out
cd $out
${lib.concatMapStrings (x: ''
mkdir -p "$(dirname ${lib.escapeShellArg x.name})"
ln -s ${lib.escapeShellArg "${x.path}"} ${lib.escapeShellArg x.name}
'') entries}
'';
linkFarm = name: entries: runCommand name {
preferLocalBuild = true;
allowSubstitutes = false;
passthru = lib.listToAttrs (map (x: lib.nameValuePair x.name x.path) entries);
} ''
mkdir -p $out
cd $out
${lib.concatMapStrings (x: ''
mkdir -p "$(dirname ${lib.escapeShellArg x.name})"
ln -s ${lib.escapeShellArg "${x.path}"} ${lib.escapeShellArg x.name}
'') entries}
'';
/*
* Easily create a linkFarm from a set of derivations.