mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
lib: ensure directories of linkFarm links exist (#45628)
There's no reason `linkFarm` can't be used for symlinks in subdirectories, except that currently it doesn't ensure the directory of the link exists. This backwards-compatible change expands the utility of the function.
This commit is contained in:
parent
173e48d5dd
commit
4af7278bc9
@ -145,7 +145,10 @@ rec {
|
||||
# entries is a list of attribute sets like { name = "name" ; path = "/nix/store/..."; }
|
||||
linkFarm = name: entries: runCommand name { preferLocalBuild = true; }
|
||||
("mkdir -p $out; cd $out; \n" +
|
||||
(lib.concatMapStrings (x: "ln -s '${x.path}' '${x.name}';\n") entries));
|
||||
(lib.concatMapStrings (x: ''
|
||||
mkdir -p "$(dirname '${x.name}')"
|
||||
ln -s '${x.path}' '${x.name}'
|
||||
'') entries));
|
||||
|
||||
|
||||
# Print an error message if the file with the specified name and
|
||||
|
Loading…
Reference in New Issue
Block a user