forked from mirrors/nixpkgs
fetchCrate: add unpack option to use fetchurl instead of fetchzip
This commit is contained in:
parent
cce677256a
commit
62327ff6a9
|
@ -1,15 +1,17 @@
|
|||
{ lib, fetchzip }:
|
||||
{ lib, fetchzip, fetchurl }:
|
||||
|
||||
{ crateName ? args.pname
|
||||
, pname ? null
|
||||
, version
|
||||
, unpack ? true
|
||||
, ...
|
||||
} @ args:
|
||||
|
||||
assert pname == null || pname == crateName;
|
||||
|
||||
fetchzip ({
|
||||
(if unpack then fetchzip else fetchurl) ({
|
||||
name = "${crateName}-${version}.tar.gz";
|
||||
url = "https://crates.io/api/v1/crates/${crateName}/${version}/download";
|
||||
} // lib.optionalAttrs unpack {
|
||||
extension = "tar.gz";
|
||||
} // removeAttrs args [ "crateName" "pname" "version" ])
|
||||
} // removeAttrs args [ "crateName" "pname" "version" "unpack" ])
|
||||
|
|
Loading…
Reference in a new issue