diff options
author | Vladimír Čunát <v@cunat.cz> | 2023-09-12 19:06:44 +0200 |
---|---|---|
committer | Vladimír Čunát <v@cunat.cz> | 2023-09-12 19:06:44 +0200 |
commit | 300eaad172fef6365ffd06d3816c2e6377c46311 (patch) | |
tree | b877cef4af6268503496fe59cc0f72a36da32b9f /pkgs/test/nixpkgs-check-by-name/src/eval.rs | |
parent | bc6f47f644cc42eed1fab8d0e16bb4ce32833f52 (diff) | |
parent | b874fb56d0f07a0ff88fcdc17e0001760ca89556 (diff) | |
download | nixlib-300eaad172fef6365ffd06d3816c2e6377c46311.tar nixlib-300eaad172fef6365ffd06d3816c2e6377c46311.tar.gz nixlib-300eaad172fef6365ffd06d3816c2e6377c46311.tar.bz2 nixlib-300eaad172fef6365ffd06d3816c2e6377c46311.tar.lz nixlib-300eaad172fef6365ffd06d3816c2e6377c46311.tar.xz nixlib-300eaad172fef6365ffd06d3816c2e6377c46311.tar.zst nixlib-300eaad172fef6365ffd06d3816c2e6377c46311.zip |
Merge branch 'master' into staging-next
Diffstat (limited to 'pkgs/test/nixpkgs-check-by-name/src/eval.rs')
-rw-r--r-- | pkgs/test/nixpkgs-check-by-name/src/eval.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pkgs/test/nixpkgs-check-by-name/src/eval.rs b/pkgs/test/nixpkgs-check-by-name/src/eval.rs index d084642ffe7e..17e22495b22a 100644 --- a/pkgs/test/nixpkgs-check-by-name/src/eval.rs +++ b/pkgs/test/nixpkgs-check-by-name/src/eval.rs @@ -30,9 +30,15 @@ pub fn check_values<W: io::Write>( // Write the list of packages we need to check into a temporary JSON file. // This can then get read by the Nix evaluation. let attrs_file = NamedTempFile::new().context("Failed to create a temporary file")?; + // We need to canonicalise this path because if it's a symlink (which can be the case on + // Darwin), Nix would need to read both the symlink and the target path, therefore need 2 + // NIX_PATH entries for restrict-eval. But if we resolve the symlinks then only one predictable + // entry is needed. + let attrs_file_path = attrs_file.path().canonicalize()?; + serde_json::to_writer(&attrs_file, &nixpkgs.package_names).context(format!( "Failed to serialise the package names to the temporary path {}", - attrs_file.path().display() + attrs_file_path.display() ))?; // With restrict-eval, only paths in NIX_PATH can be accessed, so we explicitly specify the @@ -57,9 +63,9 @@ pub fn check_values<W: io::Write>( // Pass the path to the attrs_file as an argument and add it to the NIX_PATH so it can be // accessed in restrict-eval mode .args(["--arg", "attrsPath"]) - .arg(attrs_file.path()) + .arg(&attrs_file_path) .arg("-I") - .arg(attrs_file.path()) + .arg(&attrs_file_path) // Same for the nixpkgs to test .args(["--arg", "nixpkgsPath"]) .arg(&nixpkgs.path) |