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 { crateName ? args.pname
, pname ? null , pname ? null
, version , version
, unpack ? true
, ... , ...
} @ args: } @ args:
assert pname == null || pname == crateName; assert pname == null || pname == crateName;
fetchzip ({ (if unpack then fetchzip else fetchurl) ({
name = "${crateName}-${version}.tar.gz"; name = "${crateName}-${version}.tar.gz";
url = "https://crates.io/api/v1/crates/${crateName}/${version}/download"; url = "https://crates.io/api/v1/crates/${crateName}/${version}/download";
} // lib.optionalAttrs unpack {
extension = "tar.gz"; extension = "tar.gz";
} // removeAttrs args [ "crateName" "pname" "version" ]) } // removeAttrs args [ "crateName" "pname" "version" "unpack" ])