diff options
author | Daniël de Kok <me@danieldk.eu> | 2020-08-26 14:56:19 +0200 |
---|---|---|
committer | Daniël de Kok <me@danieldk.eu> | 2020-08-28 08:34:22 +0200 |
commit | 923c9f62c42e565d58c79c346adc4d5385166e7a (patch) | |
tree | 2999f3dadb37e9cdc9da1ebdac6bba3c94eb1491 /pkgs/build-support | |
parent | 0885b9da4807c00f7a26ebc030505921866e4fa0 (diff) |
fetchCrate: accept pname besides crateName
This enables short argument attrsets similar to fetchPypi: src = fetchCrate { inherit pname version; sha256 = "02h8pikmk19ziqw9jgxxf7kjhnb3792vz9is446p1xfvlh4mzmyx"; };
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/rust/fetchcrate.nix | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkgs/build-support/rust/fetchcrate.nix b/pkgs/build-support/rust/fetchcrate.nix index 95dfd38b12ae9..4e6c38b032ce6 100644 --- a/pkgs/build-support/rust/fetchcrate.nix +++ b/pkgs/build-support/rust/fetchcrate.nix @@ -1,10 +1,13 @@ { lib, fetchurl, unzip }: -{ crateName +{ crateName ? args.pname +, pname ? null , version , sha256 , ... } @ args: +assert pname == null || pname == crateName; + lib.overrideDerivation (fetchurl ({ name = "${crateName}-${version}.tar.gz"; @@ -30,6 +33,6 @@ lib.overrideDerivation (fetchurl ({ fi mv "$unpackDir/$fn" "$out" ''; -} // removeAttrs args [ "crateName" "version" ])) +} // removeAttrs args [ "crateName" "pname" "version" ])) # Hackety-hack: we actually need unzip hooks, too (x: {nativeBuildInputs = x.nativeBuildInputs++ [unzip];}) |