From f2a91a66798a192fa14f94a04aad1e9ce5ea1814 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 14 May 2022 19:23:15 +0200 Subject: [PATCH 1/2] Fix string context lost in `linkFarm` ```nix let pkgs = import ./. {}; in pkgs.linkFarm "test" [ { name = "foo"; path = ./README.md; } ] ``` The nix code above generates this result: (`nix build -f test.nix`) ``` lrwxrwxrwx 1 root root 31 Jan 1 1970 /nix/store/98mdz626n99w0467q4r203q154bnnli9-test/foo -> /home/juloo/w/nixpkgs/README.md ``` With this patch, the target file is naturally copied into the store: ``` lrwxrwxrwx 1 root root 53 Jan 1 1970 /nix/store/ndvffnardifqwzbp07g15llav55r5k1m-test/foo -> /nix/store/9rqwjskbbgbflrpyhzi6rak2j7jspr5f-README.md ``` --- pkgs/build-support/trivial-builders.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index bd14971fe78b..aab032928cc3 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -477,7 +477,7 @@ rec { cd $out ${lib.concatMapStrings (x: '' mkdir -p "$(dirname ${lib.escapeShellArg x.name})" - ln -s ${lib.escapeShellArg x.path} ${lib.escapeShellArg x.name} + ln -s ${x.path} ${lib.escapeShellArg x.name} '') entries} ''; From 4acd65ce956ab34ad6383d3bf5add34278060a18 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 15 May 2022 21:29:01 +0200 Subject: [PATCH 2/2] Escape paths Co-authored-by: pennae <82953136+pennae@users.noreply.github.com> --- pkgs/build-support/trivial-builders.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index aab032928cc3..d6e49a93c58e 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -477,7 +477,7 @@ rec { cd $out ${lib.concatMapStrings (x: '' mkdir -p "$(dirname ${lib.escapeShellArg x.name})" - ln -s ${x.path} ${lib.escapeShellArg x.name} + ln -s ${lib.escapeShellArg "${x.path}"} ${lib.escapeShellArg x.name} '') entries} '';