buildRustPackage: fix overrideAttrs #179392
Conversation
…rgoSha256' will convert the whole file to use finalAttrs
this commit doesn't change any hashes yet this fixes overriding cargoSha256 and other attrs so no need to overriding cargoDeps anymore
pennae
left a comment
There was a problem hiding this comment.
seems to work fine. just a few nitpicks that might not even affect normal operation though.
| else if cargoLock != null then importCargoLock cargoLock | ||
| else | ||
| fetchCargoTarball ({ | ||
| src = finalAttrs.src or ""; |
There was a problem hiding this comment.
| src = finalAttrs.src or ""; | |
| src = finalAttrs.src or null; |
probably not meaningful anyway, but keeping the default unchanged seems nicer
| hash = finalAttrs.cargoHash; | ||
| } // lib.optionalAttrs (finalAttrs ? cargoSha256) { | ||
| sha256 = finalAttrs.cargoSha256; | ||
| } // (args.depsExtraArgs or { })); |
There was a problem hiding this comment.
should this be?
| } // (args.depsExtraArgs or { })); | |
| } // (finalAttrs.depsExtraArgs or args.depsExtraArgs or { })); |
| maybeSetStr = x: lib.optionalString (previousAttrs ? ${x}) previousAttrs.${x}; | ||
| maybeSetListFromPrevious = x: lib.optionals (previousAttrs ? ${x}) previousAttrs.${x}; |
There was a problem hiding this comment.
is there a specific reason to use these instead of
| maybeSetStr = x: lib.optionalString (previousAttrs ? ${x}) previousAttrs.${x}; | |
| maybeSetListFromPrevious = x: lib.optionals (previousAttrs ? ${x}) previousAttrs.${x}; | |
| maybeSetStr = x: previousAttrs.${x} or ""; | |
| maybeSetListFromPrevious = x: previousAttrs.${x} or []; |
or inlining them outright? looks like it'd be equivalent and eval slightly faster
| if cargoVendorDir != null then null | ||
| else if cargoLock != null then importCargoLock cargoLock |
There was a problem hiding this comment.
maybe these should be overridable from finalAttrs as well
| cargoCheckNoDefaultFeatures = pickPreviousOrFinalOrDefault "cargoCheckNoDefaultFeatures" "checkNoDefaultFeatures" | ||
| finalAttrs.cargoBuildNoDefaultFeatures; | ||
|
|
||
| cargoBuildFeatures = pickPreviousOrFinalOrDefault "cargoBuildFeatures" "buildFeatures" ""; |
There was a problem hiding this comment.
| cargoBuildFeatures = pickPreviousOrFinalOrDefault "cargoBuildFeatures" "buildFeatures" ""; | |
| cargoBuildFeatures = pickPreviousOrFinalOrDefault "cargoBuildFeatures" "buildFeatures" []; |
old default was [], probably better to keep it like that?
|
|
||
| patches = (finalAttrs.cargoPatches or [ ]) ++ maybeSetListFromPrevious "patches"; | ||
|
|
||
| PKG_CONFIG_ALLOW_CROSS = previousAttrs.PKG_CONFIG_ALLOW_CROSS or |
There was a problem hiding this comment.
does this (technically) change the behavior of this binding? looks like previously the value from args would always be overwritten.
| doCheck = previousAttrs.doCheck or true; | ||
|
|
||
| doCheck = args.doCheck or true; | ||
| strictDeps = previousAttrs.strictDeps or true; |
There was a problem hiding this comment.
same here, previously we'd always set this to true. probably better to leave it like that anyway.
|
Anything needed for this? It would be really nice to be able to override |
this commit doesn't change any hashes yet
this fixes overriding cargoSha256 and other attrs
so no need to overriding cargoDeps anymore
will drop the first 2 commits before merge
Closes #107070
Description of changes
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes