diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 24deac21c59..fe801c6bb97 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -463,7 +463,9 @@ _defaultUnpack() { if [ -d "$fn" ]; then stripHash "$fn" - cp -prd --no-preserve=timestamps "$fn" $strippedName + # We can't preserve hardlinks because they may have been introduced by + # store optimization, which might break things in the build + cp -pr --reflink=auto --no-preserve=timestamps "$fn" $strippedName else