buildRustPackage: restructure with lib.extendMkDerivation
Support fixed-point arguments with lib.extendMkDerivation Postpone formatting for more concise diff.
This commit is contained in:
@@ -18,6 +18,18 @@
|
||||
windows,
|
||||
}:
|
||||
|
||||
lib.extendMkDerivation {
|
||||
constructDrv = stdenv.mkDerivation;
|
||||
|
||||
excludeDrvArgNames = [
|
||||
"depsExtraArgs"
|
||||
"cargoUpdateHook"
|
||||
"cargoDeps"
|
||||
"cargoLock"
|
||||
];
|
||||
|
||||
extendDrvArgs =
|
||||
finalAttrs:
|
||||
{
|
||||
name ? "${args.pname}-${args.version}",
|
||||
|
||||
@@ -119,15 +131,7 @@ let
|
||||
target = stdenv.hostPlatform.rust.rustcTargetSpec;
|
||||
targetIsJSON = lib.hasSuffix ".json" target;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (
|
||||
(removeAttrs args [
|
||||
"depsExtraArgs"
|
||||
"cargoUpdateHook"
|
||||
"cargoDeps"
|
||||
"cargoLock"
|
||||
])
|
||||
// lib.optionalAttrs (stdenv.hostPlatform.isDarwin && buildType == "debug") {
|
||||
lib.optionalAttrs (stdenv.hostPlatform.isDarwin && buildType == "debug") {
|
||||
RUSTFLAGS = "-C split-debuginfo=packed " + (args.RUSTFLAGS or "");
|
||||
}
|
||||
// {
|
||||
@@ -194,5 +198,5 @@ stdenv.mkDerivation (
|
||||
# default to Rust's platforms
|
||||
platforms = lib.intersectLists meta.platforms or lib.platforms.all rustc.targetPlatforms;
|
||||
};
|
||||
}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user