mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
d456b861b8
follow up to #234066, since I made a mistake
21 lines
629 B
Nix
21 lines
629 B
Nix
{ lib, fetchzip, fetchurl }:
|
|
|
|
{ crateName ? args.pname
|
|
, pname ? null
|
|
# The `dl` field of the registry's index configuration
|
|
# https://doc.rust-lang.org/cargo/reference/registry-index.html#index-configuration
|
|
, registryDl ? "https://crates.io/api/v1/crates"
|
|
, version
|
|
, unpack ? true
|
|
, ...
|
|
} @ args:
|
|
|
|
assert pname == null || pname == crateName;
|
|
|
|
(if unpack then fetchzip else fetchurl) ({
|
|
name = "${crateName}-${version}.tar.gz";
|
|
url = "${registryDl}/${crateName}/${version}/download";
|
|
} // lib.optionalAttrs unpack {
|
|
extension = "tar.gz";
|
|
} // removeAttrs args [ "crateName" "pname" "registryDl" "version" "unpack" ])
|