nixosTestLib: substitute dependencies on tools in
This commit is contained in:
@@ -37,6 +37,11 @@
|
|||||||
setuptools
|
setuptools
|
||||||
wheel
|
wheel
|
||||||
];
|
];
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace nixos_test_lib/nix_setup.py \
|
||||||
|
--replace '@cp@' '${pkgs.coreutils}/bin/cp' \
|
||||||
|
--replace '@nix-store@' '${pkgs.nix}/bin/nix-store'
|
||||||
|
'';
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
# These paths will be substituted during package build
|
||||||
|
CP_BIN = "@cp@"
|
||||||
|
NIX_STORE_BIN = "@nix-store@"
|
||||||
|
|
||||||
|
|
||||||
def setup_nix_in_nix(closure_info: str | None) -> None:
|
def setup_nix_in_nix(closure_info: str | None) -> None:
|
||||||
"""Set up Nix store inside test environment
|
"""Set up Nix store inside test environment
|
||||||
@@ -44,7 +48,7 @@ def setup_nix_in_nix(closure_info: str | None) -> None:
|
|||||||
# Copy store paths to test store using external cp command
|
# Copy store paths to test store using external cp command
|
||||||
# (handles symlinks better)
|
# (handles symlinks better)
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["cp", "--recursive", "--target", f"{tmpdir}/store"]
|
[CP_BIN, "--recursive", "--target", f"{tmpdir}/store"]
|
||||||
+ [path.strip() for path in store_paths if path.strip()],
|
+ [path.strip() for path in store_paths if path.strip()],
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
@@ -57,7 +61,7 @@ def setup_nix_in_nix(closure_info: str | None) -> None:
|
|||||||
|
|
||||||
with registration_file.open() as f:
|
with registration_file.open() as f:
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["nix-store", "--load-db"],
|
[NIX_STORE_BIN, "--load-db"],
|
||||||
input=f.read(),
|
input=f.read(),
|
||||||
text=True,
|
text=True,
|
||||||
env=env,
|
env=env,
|
||||||
|
|||||||
Reference in New Issue
Block a user