Use copy-on-write if possible

This commit is contained in:
Stéphan Kochen
2024-02-05 16:12:18 +01:00
parent 727d9d2feb
commit b08b1a05ef
+6 -6
View File
@@ -62,7 +62,7 @@ let
# Create a shell snippet to copy dependencies from a list of derivations. # Create a shell snippet to copy dependencies from a list of derivations.
mkCacheBuilderForDrvs = drvs: mkCacheBuilderForDrvs = drvs:
writeShellScript "collect-yarn-cache" (lib.concatMapStrings (drv: '' writeShellScript "collect-yarn-cache" (lib.concatMapStrings (drv: ''
cp ${drv} '${drv.outputFilename}' cp --reflink=auto ${drv} '${drv.outputFilename}'
'') drvs); '') drvs);
#@@ IF NEED_ISOLATED_BUILD_SUPPRORT #@@ IF NEED_ISOLATED_BUILD_SUPPRORT
@@ -170,16 +170,16 @@ let
mkdir -p "$out/libexec/$name" mkdir -p "$out/libexec/$name"
tar xzvf package.tgz --directory "$out/libexec/$name" --strip-components=1 tar xzvf package.tgz --directory "$out/libexec/$name" --strip-components=1
cp .yarnrc* "$out/libexec/$name" cp --reflink=auto .yarnrc* "$out/libexec/$name"
cp ${lockfile} "$out/libexec/$name/yarn.lock" cp --reflink=auto ${lockfile} "$out/libexec/$name/yarn.lock"
cp --recursive .yarn "$out/libexec/$name" cp --reflink=auto --recursive .yarn "$out/libexec/$name"
# Copy the Yarn linker output into the package. # Copy the Yarn linker output into the package.
#@@ IF USES_PNP_LINKER #@@ IF USES_PNP_LINKER
cp .pnp.* "$out/libexec/$name" cp --reflink=auto .pnp.* "$out/libexec/$name"
#@@ ENDIF USES_PNP_LINKER #@@ ENDIF USES_PNP_LINKER
#@@ IF USES_NM_LINKER #@@ IF USES_NM_LINKER
cp --recursive node_modules "$out/libexec/$name" cp --reflink=auto --recursive node_modules "$out/libexec/$name"
#@@ ENDIF USES_NM_LINKER #@@ ENDIF USES_NM_LINKER
fi fi