nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ fetchurl, buildDotnetPackage, unzip }:
2
3attrs @
4{ pname
5, version
6, url ? "https://www.nuget.org/api/v2/package/${pname}/${version}"
7, sha256 ? ""
8, md5 ? ""
9, ...
10}:
11if md5 != "" then
12 throw "fetchnuget does not support md5 anymore, please use sha256"
13else
14 buildDotnetPackage ({
15 src = fetchurl {
16 inherit url sha256;
17 name = "${pname}.${version}.zip";
18 };
19
20 sourceRoot = ".";
21
22 nativeBuildInputs = [ unzip ];
23
24 dontBuild = true;
25
26 preInstall = ''
27 function traverseRename () {
28 for e in *
29 do
30 t="$(echo "$e" | sed -e "s/%20/\ /g" -e "s/%2B/+/g")"
31 [ "$t" != "$e" ] && mv -vn "$e" "$t"
32 if [ -d "$t" ]
33 then
34 cd "$t"
35 traverseRename
36 cd ..
37 fi
38 done
39 }
40
41 traverseRename
42 '';
43 } // attrs)