fix(nix): evaluation no longer reads store paths that builtins.path makes

nix flake check --no-build failed in the nix-eval job on the runner with "path ...-Cargo.lock is not
valid": crane's vendorCargoDeps runs pathExists on the lock at evaluation time, and `repoFile` is a
store path that builtins.path makes during evaluation. Nix 2.35 with an empty store, as on a fresh
runner, does not have it yet under --no-build; Lix, and a store that had seen the file, do.

The parsed lock now comes from the flake source (cargoLockParsed in nix/lib.nix), and the Windows guest
reads tools/test-partition.json the same way. The derivations are unchanged (same drv paths), so no
cache key moves. Reproduced and fixed with upstream Nix and an empty store:
nix shell nixpkgs#nixVersions.latest -c nix flake check --no-build --all-systems --store <empty dir>
This commit is contained in:
LGUG2Z committed 2026-11-05 16:48:10 -08:00
1 parent 166e5f353a
commit 82366f7134
7 files changed
+29 -6

No files matched your search

+8
View File
@@ -14,6 +14,14 @@ rec {
name = builtins.baseNameOf rel;
};
# The lock, parsed at evaluation from the source of the flake itself. crane's `vendorCargoDeps` reads the lock it is
# given while evaluating (`pathExists`, `readFile`), and `repoFile` above is a store path that `builtins.path` makes
# during evaluation: Nix 2.35 on a runner whose store is empty does not have it there yet under
# `nix flake check --no-build` ("path ... is not valid"), though Lix and a store that has seen it do. The
# parsed lock is handed to `vendorCargoDeps` next to `cargoLock = repoFile "Cargo.lock"`, which is still what
# the derivations name, so that an edit of any other file does not change them.
cargoLockParsed = builtins.fromTOML (builtins.readFile (repoRoot + "/Cargo.lock"));
# the version of the workspace: every package says `version.workspace = true`
version =
(builtins.fromTOML (builtins.readFile (repoRoot + "/Cargo.toml"))).workspace.package.version;
+4 -1
View File
@@ -35,7 +35,10 @@ in
# would then change the dependencies
cargoLock = lockFile;
cargoToml = tomlFile;
cargoVendorDir = craneLib.vendorCargoDeps { cargoLock = lockFile; };
cargoVendorDir = craneLib.vendorCargoDeps {
cargoLock = lockFile;
inherit (lib') cargoLockParsed;
};
};
commonArgs = workspaceArgs // {
+4 -1
View File
@@ -35,7 +35,10 @@ in
# would then change the dependencies
cargoLock = lockFile;
cargoToml = tomlFile;
cargoVendorDir = craneLib.vendorCargoDeps { cargoLock = lockFile; };
cargoVendorDir = craneLib.vendorCargoDeps {
cargoLock = lockFile;
inherit (lib') cargoLockParsed;
};
};
commonArgs = workspaceArgs // {
+4 -1
View File
@@ -36,7 +36,10 @@ in
# would then change the dependencies
cargoLock = lockFile;
cargoToml = tomlFile;
cargoVendorDir = craneLib.vendorCargoDeps { cargoLock = lockFile; };
cargoVendorDir = craneLib.vendorCargoDeps {
cargoLock = lockFile;
inherit (lib') cargoLockParsed;
};
strictDeps = true;
};
+4 -1
View File
@@ -38,7 +38,10 @@ in
# would then change the dependencies
cargoLock = lockFile;
cargoToml = tomlFile;
cargoVendorDir = craneLib.vendorCargoDeps { cargoLock = lockFile; };
cargoVendorDir = craneLib.vendorCargoDeps {
cargoLock = lockFile;
inherit (lib') cargoLockParsed;
};
strictDeps = true;
# the commit of the komorebi source the build script indexes: a constant, so that the
# dependencies and every check are the same derivations for every commit; only the build
+4 -1
View File
@@ -181,7 +181,10 @@ let
# would change the dependencies
cargoLock = lockFile;
cargoToml = tomlFile;
cargoVendorDir = craneLib.vendorCargoDeps { cargoLock = lockFile; };
cargoVendorDir = craneLib.vendorCargoDeps {
cargoLock = lockFile;
inherit (lib') cargoLockParsed;
};
};
commonArgs = workspaceArgs // {
+1 -1
View File
@@ -65,7 +65,7 @@ in
# the packages whose tests the guest runs by default: the partition (tools/test-partition.json, the
# one list of which package is tested where) says which are the Windows ones, and which are neutral
# but depend on the OS (sockets, pipes, paths, the registry). The neutral ones run on Linux.
partition = builtins.fromJSON (builtins.readFile (lib'.repoFile "tools/test-partition.json"));
partition = builtins.fromJSON (builtins.readFile (lib'.repoRoot + "/tools/test-partition.json"));
windowsPackages = partition.windows ++ partition.os_sensitive;
selected = pkgs.lib.concatMapStringsSep " " (p: "-p ${p}") windowsPackages;
# the members that are stubs here (the Linux and macOS packages) have no test and do not build