mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-28 22:32:58 +03:00
fetchCrate: accept pname besides crateName
This enables short argument attrsets similar to fetchPypi: src = fetchCrate { inherit pname version; sha256 = "02h8pikmk19ziqw9jgxxf7kjhnb3792vz9is446p1xfvlh4mzmyx"; };
This commit is contained in:
parent
0885b9da48
commit
923c9f62c4
@ -1,10 +1,13 @@
|
|||||||
{ lib, fetchurl, unzip }:
|
{ lib, fetchurl, unzip }:
|
||||||
|
|
||||||
{ crateName
|
{ crateName ? args.pname
|
||||||
|
, pname ? null
|
||||||
, version
|
, version
|
||||||
, sha256
|
, sha256
|
||||||
, ... } @ args:
|
, ... } @ args:
|
||||||
|
|
||||||
|
assert pname == null || pname == crateName;
|
||||||
|
|
||||||
lib.overrideDerivation (fetchurl ({
|
lib.overrideDerivation (fetchurl ({
|
||||||
|
|
||||||
name = "${crateName}-${version}.tar.gz";
|
name = "${crateName}-${version}.tar.gz";
|
||||||
@ -30,6 +33,6 @@ lib.overrideDerivation (fetchurl ({
|
|||||||
fi
|
fi
|
||||||
mv "$unpackDir/$fn" "$out"
|
mv "$unpackDir/$fn" "$out"
|
||||||
'';
|
'';
|
||||||
} // removeAttrs args [ "crateName" "version" ]))
|
} // removeAttrs args [ "crateName" "pname" "version" ]))
|
||||||
# Hackety-hack: we actually need unzip hooks, too
|
# Hackety-hack: we actually need unzip hooks, too
|
||||||
(x: {nativeBuildInputs = x.nativeBuildInputs++ [unzip];})
|
(x: {nativeBuildInputs = x.nativeBuildInputs++ [unzip];})
|
||||||
|
Loading…
Reference in New Issue
Block a user