mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-19 11:00:19 +03:00
18 lines
442 B
Nix
18 lines
442 B
Nix
{ lib, fetchzip, fetchurl }:
|
|
|
|
{ crateName ? args.pname
|
|
, pname ? null
|
|
, version
|
|
, unpack ? true
|
|
, ...
|
|
} @ args:
|
|
|
|
assert pname == null || pname == crateName;
|
|
|
|
(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" "unpack" ])
|