From 096e3cbdec300579ad6f46f056e1dc5427617a35 Mon Sep 17 00:00:00 2001 From: Alex Biehl Date: Wed, 27 Mar 2019 11:34:35 +0100 Subject: [PATCH 1/2] Add /nix/store to each layer.tar To be totally consistent with the way Docker builds images we need to include the /nix/store in the layer tarballs first. --- pkgs/build-support/docker/store-path-to-layer.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/build-support/docker/store-path-to-layer.sh b/pkgs/build-support/docker/store-path-to-layer.sh index ff814c1f6130..4cf338b9b252 100755 --- a/pkgs/build-support/docker/store-path-to-layer.sh +++ b/pkgs/build-support/docker/store-path-to-layer.sh @@ -9,6 +9,7 @@ layerPath="./layers/$layerNumber" echo "Creating layer #$layerNumber for $@" mkdir -p "$layerPath" +tar --no-recursion -rf "$layerPath/layer.tar" /nix /nix/store tar -rpf "$layerPath/layer.tar" --hard-dereference --sort=name \ --mtime="@$SOURCE_DATE_EPOCH" \ --owner=0 --group=0 "$@" From 1b1e23024ba24e3df85ede12d6a1f30f871dcb10 Mon Sep 17 00:00:00 2001 From: Alex Biehl Date: Wed, 27 Mar 2019 12:08:50 +0100 Subject: [PATCH 2/2] Strip leading ./ in customization layer --- pkgs/build-support/docker/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix index 6efb447e1424..3ac376e267e5 100644 --- a/pkgs/build-support/docker/default.nix +++ b/pkgs/build-support/docker/default.nix @@ -344,7 +344,7 @@ rec { # Tar up the layer and throw it into 'layer.tar'. echo "Packing layer..." mkdir $out - tar -C layer --sort=name --mtime="@$SOURCE_DATE_EPOCH" --owner=${toString uid} --group=${toString gid} -cf $out/layer.tar . + tar --transform='s|^\./||' -C layer --sort=name --mtime="@$SOURCE_DATE_EPOCH" --owner=${toString uid} --group=${toString gid} -cf $out/layer.tar . # Compute a checksum of the tarball. echo "Computing layer checksum..."