mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
rustPlatform.fetchCargoTarball: support pname, version
This commit is contained in:
parent
1f0f59d5a1
commit
3207bc2237
@ -26,7 +26,9 @@ let
|
||||
};
|
||||
in
|
||||
{
|
||||
name ? "cargo-deps",
|
||||
pname ? null,
|
||||
version ? null,
|
||||
name ? if args ? pname && args ? version then "${pname}-${version}" else "cargo-deps",
|
||||
src ? null,
|
||||
srcs ? [ ],
|
||||
patches ? [ ],
|
||||
@ -36,7 +38,23 @@ in
|
||||
...
|
||||
}@args:
|
||||
|
||||
assert lib.assertMsg (
|
||||
(args ? pname || args ? version) -> !(args ? name)
|
||||
) "Either specify `pname` with `version`, or specify `name` only, not a mix of both.";
|
||||
assert lib.assertMsg (
|
||||
args ? pname == args ? version
|
||||
) "If `pname` is specified, `version` must be also, and vice versa.";
|
||||
let
|
||||
# args to remove from the final call to stdenv.mkDerivation, as we've already handled them
|
||||
removedArgs = [
|
||||
"name"
|
||||
"pname"
|
||||
"version"
|
||||
"sha256"
|
||||
"cargoUpdateHook"
|
||||
"nativeBuildInputs"
|
||||
];
|
||||
|
||||
hash_ =
|
||||
if args ? hash then
|
||||
{
|
||||
@ -134,10 +152,5 @@ stdenv.mkDerivation (
|
||||
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [ "NIX_CRATES_INDEX" ];
|
||||
}
|
||||
// (builtins.removeAttrs args [
|
||||
"name"
|
||||
"sha256"
|
||||
"cargoUpdateHook"
|
||||
"nativeBuildInputs"
|
||||
])
|
||||
// (removeAttrs args removedArgs)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user