diff options
| author | tv <tv@krebsco.de> | 2026-11-11 15:42:33 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-11 15:42:33 +0100 |
| commit | 06f350cf7d5a9b0ea73c2afa828e60282d080a64 (patch) | |
| tree | fe84f8996d15edc2e660af7e62784aa0adb47354 /pkgs/rust/default.nix | |
| parent | 0febb98b3f86a3dbbdc2903d8aab957249dff341 (diff) | |
Diffstat (limited to 'pkgs/rust/default.nix')
| -rw-r--r-- | pkgs/rust/default.nix | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/pkgs/rust/default.nix b/pkgs/rust/default.nix index f6c7eb7..c26cf9d 100644 --- a/pkgs/rust/default.nix +++ b/pkgs/rust/default.nix @@ -31,10 +31,15 @@ let resolvedJson = path + "/Cargo.json"; }; - # The checkout's Cargo.lock, to check the JSON plan against. - localLock = path: - lib.optionalAttrs (builtins.pathExists (path + "/Cargo.lock")) { - cargoLock = path + "/Cargo.lock"; + # Checks the JSON plan against the checkout's Cargo.lock and Cargo.toml. + # These come from dir, not src, because cleanCargoSource drops Cargo.lock + # next to a Cargo.json. + planChecks = dir: + lib.optionalAttrs (builtins.pathExists (dir + "/Cargo.lock")) { + cargoLock = dir + "/Cargo.lock"; + } + // lib.optionalAttrs (builtins.pathExists (dir + "/Cargo.toml")) { + cargoToml = dir + "/Cargo.toml"; }; in @@ -78,10 +83,10 @@ in in if explicitPackages ? ${pname} then assert mylib.debug "pkgs/rust: overriding ${pname}.src with ${mylib.pretty dir}"; - hrmPlan explicitPackages.${pname} // callArgs explicitPackages.${pname} // { inherit src; } // localLock dir + hrmPlan explicitPackages.${pname} // callArgs explicitPackages.${pname} // { inherit src; } // planChecks dir else assert mylib.debug "pkgs/rust: automatic package ${pname} from ${mylib.pretty dir}"; - { name = pname; inherit src; } // localLock dir + { name = pname; inherit src; } // planChecks dir ) automaticPackages; |
