diff options
author | Alyssa Ross <hi@alyssa.is> | 2018-09-01 14:53:23 +0200 |
---|---|---|
committer | xeji <36407913+xeji@users.noreply.github.com> | 2018-09-01 14:53:23 +0200 |
commit | 4af7278bc91ecb7b61d72f41c544f74271385760 (patch) | |
tree | 0dda794eb8256a5e67c395d7e31d4c7bc3dcadae /pkgs/build-support/trivial-builders.nix | |
parent | 173e48d5dd57bb0f4774b3af681ad4199824d7fe (diff) |
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.
Diffstat (limited to 'pkgs/build-support/trivial-builders.nix')
-rw-r--r-- | pkgs/build-support/trivial-builders.nix | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index f9816b2d0d7c..d2acc2679afa 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -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 |