about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2020-06-19 09:02:17 +0200
committerRobert Hensing <robert@roberthensing.nl>2020-06-19 10:08:34 +0200
commit2dd94af18650aee1b53c9509832068b60c1b1225 (patch)
treea3b43463e292133a33e2c8bbffd800bfb2b179f1 /pkgs/build-support
parentcaf47063b4b5d82a61753ea437f97e5642eedd03 (diff)
dockerTools: keep symlinks to nix intact
Diffstat (limited to 'pkgs/build-support')
-rwxr-xr-xpkgs/build-support/docker/store-path-to-layer.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkgs/build-support/docker/store-path-to-layer.sh b/pkgs/build-support/docker/store-path-to-layer.sh
index 7437da51cc4a4..3a1fcd0c27a18 100755
--- a/pkgs/build-support/docker/store-path-to-layer.sh
+++ b/pkgs/build-support/docker/store-path-to-layer.sh
@@ -16,7 +16,11 @@ mkdir -p "$layerPath"
 # when there are other things being added to the
 # nix store, tar could fail, saying,
 # "tar: /nix/store: file changed as we read it"
-mkdir -p nix/store
+#
+# In addition, we use `__Nix__` instead of `nix` to avoid renaming
+# relative symlink destinations like
+# /nix/store/...-nix-2.3.4/bin/nix-daemon -> nix
+mkdir -p __Nix__/store
 
 # Then we change into the /nix/store in order to
 # avoid a similar "file changed as we read it" error
@@ -35,8 +39,8 @@ tarhash=$(
       --hard-dereference --sort=name \
       --mtime="@$SOURCE_DATE_EPOCH" \
       --owner=0 --group=0 \
-      --transform 's,^nix$,/\0,' \
-      --transform 's,^nix/store$,/\0,' \
+      --transform 's,^__Nix__$,/nix,' \
+      --transform 's,^__Nix__/store$,/nix/store,' \
       --transform 's,^[^/],/nix/store/\0,rS' |
     tee "$layerPath/layer.tar" |
     tarsum