-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buildRustPackage: fix overrideAttrs #179392
base: master
Are you sure you want to change the base?
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this (technically) change the behavior of this binding? looks like previously the value from args
would always be overwritten.
|
||
doCheck = args.doCheck or true; | ||
strictDeps = previousAttrs.strictDeps or true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 = true
set 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.sh
to update generated release notes