summaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/rust/default.nix19
1 files changed, 11 insertions, 8 deletions
diff --git a/pkgs/rust/default.nix b/pkgs/rust/default.nix
index a557ccfd..9d4f790d 100644
--- a/pkgs/rust/default.nix
+++ b/pkgs/rust/default.nix
@@ -24,12 +24,13 @@ let
# which crate2nix-package.nix would reject as unexpected arguments.
callArgs = path: builtins.removeAttrs (self.callPackage path {}) [ "override" "overrideDerivation" ];
- # A plan kept next to the package in hrm: pkgs/rust/<pname>/Cargo.json.
+ # A plan kept next to the package in hrm: pkgs/rust/<pname>/Cargo.json,
+ # unless the package's source has a plan of its own, which then applies.
# Settings in the package file itself take precedence.
- hrmPlan = path:
- lib.optionalAttrs (builtins.pathExists (path + "/Cargo.json")) {
- resolvedJson = path + "/Cargo.json";
- };
+ hrmPlan = path: src:
+ lib.optionalAttrs
+ (builtins.pathExists (path + "/Cargo.json") && !builtins.pathExists (src + "/Cargo.json"))
+ { resolvedJson = path + "/Cargo.json"; };
# Checks the JSON plan against the checkout's Cargo.lock and Cargo.toml.
# These come from dir, not src, because cleanCargoSource drops Cargo.lock
@@ -82,8 +83,10 @@ in
src = self.cleanCargoSource pname dir;
in
if explicitPackages ? ${pname} then
+ # With the checkout's own plan, if any: the one kept in hrm is for
+ # the package's own source.
assert mylib.debug "pkgs/rust: overriding ${pname}.src with ${mylib.pretty dir}";
- hrmPlan explicitPackages.${pname} // callArgs explicitPackages.${pname} // { inherit src; } // planChecks dir
+ callArgs explicitPackages.${pname} // { inherit src; } // planChecks dir
else
assert mylib.debug "pkgs/rust: automatic package ${pname} from ${mylib.pretty dir}";
{ name = pname; inherit src; } // planChecks dir
@@ -96,9 +99,9 @@ in
rustHrmCrateArgs =
lib.mapAttrs
(pname: path: let
- args = hrmPlan path // callArgs path;
+ args = callArgs path;
in
- args // planChecks args.src)
+ hrmPlan path args.src // args // planChecks args.src)
explicitPackages;
# Copies a Cargo workspace into the store, leaving out what the build