mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-14 12:53:43 +01:00
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>
80 lines
3.1 KiB
Nix
80 lines
3.1 KiB
Nix
# Helpers shared by the platform modules of the flake.
|
|
{ inputs }:
|
|
rec {
|
|
# the repository, as the source of the flake
|
|
repoRoot = ./..;
|
|
|
|
# a file or directory of the repository as a store path of its own: `./tools/format-all` would name
|
|
# a place in the store path of the whole flake source, which changes with every edit of the
|
|
# repository and so would rebuild the derivation that reads it
|
|
repoFile =
|
|
rel:
|
|
builtins.path {
|
|
path = repoRoot + "/${rel}";
|
|
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;
|
|
|
|
# the systems that cross-build for Windows, build the Linux packages and build the macOS packages
|
|
windowsSystems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"aarch64-darwin"
|
|
];
|
|
linuxSystems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
];
|
|
# Apple silicon also gets the checks of the KDE crates (they run against a fake desktop)
|
|
linuxCheckSystems = linuxSystems ++ [ "aarch64-darwin" ];
|
|
macosSystems = [
|
|
"aarch64-darwin"
|
|
"x86_64-darwin"
|
|
];
|
|
|
|
# The manifests (Cargo.toml, Cargo.lock, build scripts, .cargo/config.toml) of every member of the
|
|
# workspace, of all three platforms, and nothing else: crane makes the dummy source of the dependency
|
|
# derivations from it. A pure path (no derivation), so that crane reads it at evaluation without
|
|
# building anything, which `nix flake check --all-systems` needs on a host that cannot build for the
|
|
# other systems; and the same for every platform, so that the dependencies do not depend on the stubs.
|
|
manifestSource =
|
|
lib:
|
|
lib.fileset.toSource {
|
|
root = repoRoot;
|
|
fileset = lib.fileset.fileFilter (
|
|
file:
|
|
builtins.elem file.name [
|
|
"Cargo.toml"
|
|
"Cargo.lock"
|
|
"build.rs"
|
|
"config.toml"
|
|
]
|
|
) repoRoot;
|
|
};
|
|
|
|
# nixpkgs with the rust overlay, for a system (x86_64-darwin: see the input nixpkgs-x86_64-darwin)
|
|
mkPkgs = system: pkgsOf.${system};
|
|
pkgsOf = builtins.listToAttrs (
|
|
map (system: {
|
|
name = system;
|
|
value =
|
|
import (if system == "x86_64-darwin" then inputs.nixpkgs-x86_64-darwin else inputs.nixpkgs)
|
|
{
|
|
inherit system;
|
|
overlays = [ (import inputs.rust-overlay) ];
|
|
};
|
|
}) (windowsSystems ++ linuxSystems ++ macosSystems)
|
|
);
|
|
}
|