Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 37 lines 725 B view raw
1{ 2 lib, 3 fetchzip, 4 fetchurl, 5}: 6 7{ 8 crateName ? args.pname, 9 pname ? null, 10 # The `dl` field of the registry's index configuration 11 # https://doc.rust-lang.org/cargo/reference/registry-index.html#index-configuration 12 registryDl ? "https://crates.io/api/v1/crates", 13 version, 14 unpack ? true, 15 ... 16}@args: 17 18assert pname == null || pname == crateName; 19 20(if unpack then fetchzip else fetchurl) ( 21 { 22 name = "${crateName}-${version}.tar.gz"; 23 url = "${registryDl}/${crateName}/${version}/download"; 24 25 passthru = { inherit pname version; }; 26 } 27 // lib.optionalAttrs unpack { 28 extension = "tar.gz"; 29 } 30 // removeAttrs args [ 31 "crateName" 32 "pname" 33 "registryDl" 34 "version" 35 "unpack" 36 ] 37)