From 923c9f62c42e565d58c79c346adc4d5385166e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Wed, 26 Aug 2020 14:56:19 +0200 Subject: [PATCH] fetchCrate: accept pname besides crateName This enables short argument attrsets similar to fetchPypi: src = fetchCrate { inherit pname version; sha256 = "02h8pikmk19ziqw9jgxxf7kjhnb3792vz9is446p1xfvlh4mzmyx"; }; --- pkgs/build-support/rust/fetchcrate.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/rust/fetchcrate.nix b/pkgs/build-support/rust/fetchcrate.nix index 95dfd38b12a..4e6c38b032c 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];})