Merge pull request #221104 from figsoda/crate

This commit is contained in:
figsoda 2023-03-17 21:28:07 -04:00 committed by GitHub
commit 1792c4f8c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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" ])