Preserve symlinks during store copy

This commit is contained in:
Jörg Thalheim
2025-08-25 14:02:49 +02:00
parent 03a4ac5bde
commit 23d11651fc
2 changed files with 3 additions and 1 deletions

View File

@@ -15,7 +15,7 @@
mkdir -p "$CLAN_TEST_STORE/nix/store"
mkdir -p "$CLAN_TEST_STORE/nix/var/nix/gcroots"
if [[ -n "''${closureInfo-}" ]]; then
${pkgs.findutils}/bin/xargs -P"$(nproc)" ${pkgs.coreutils}/bin/cp --recursive --reflink=auto --target-directory "$CLAN_TEST_STORE/nix/store" < "$closureInfo/store-paths"
${pkgs.findutils}/bin/xargs -r -P"$(nproc)" ${pkgs.coreutils}/bin/cp --recursive --no-dereference --reflink=auto --target-directory "$CLAN_TEST_STORE/nix/store" < "$closureInfo/store-paths"
${pkgs.nix}/bin/nix-store --load-db --store "$CLAN_TEST_STORE" < "$closureInfo/registration"
fi
'';

View File

@@ -53,8 +53,10 @@ def setup_nix_in_nix(closure_info: str | None) -> None:
subprocess.run( # noqa: S603
[
XARGS_BIN,
"-r",
f"-P{num_cpus}", # Use all available CPUs
CP_BIN,
"--no-dereference",
"--recursive",
"--reflink=auto", # Use copy-on-write if available
"--target-directory",