diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix index 70fd3635b745..7218d67062e7 100644 --- a/pkgs/build-support/docker/default.nix +++ b/pkgs/build-support/docker/default.nix @@ -914,17 +914,30 @@ rec { (cd old_out; eval "$extraCommands" ) mkdir $out - ${optionalString enableFakechroot ''proot -r $PWD/old_out ${bind-paths} --pwd=/ ''}fakeroot bash -c ' - source $stdenv/setup - ${optionalString (!enableFakechroot) ''cd old_out''} - eval "$fakeRootCommands" - tar \ - --sort name \ - --numeric-owner --mtime "@$SOURCE_DATE_EPOCH" \ - --hard-dereference \ - -cf $out/layer.tar . - ' - + ${if enableFakechroot then '' + proot -r $PWD/old_out ${bind-paths} --pwd=/ --root-id bash -c ' + source $stdenv/setup + eval "$fakeRootCommands" + tar \ + --sort name \ + --exclude=./proc \ + --exclude=./sys \ + --numeric-owner --mtime "@$SOURCE_DATE_EPOCH" \ + --hard-dereference \ + -cf $out/layer.tar . + ' + '' else '' + fakeroot bash -c ' + source $stdenv/setup + cd old_out + eval "$fakeRootCommands" + tar \ + --sort name \ + --numeric-owner --mtime "@$SOURCE_DATE_EPOCH" \ + --hard-dereference \ + -cf $out/layer.tar . + ' + ''} sha256sum $out/layer.tar \ | cut -f 1 -d ' ' \ > $out/checksum