792b51d22f
GitOrigin-RevId: d5f237872975e6fb6f76eef1368b5634ffcd266f
43 lines
840 B
Nix
43 lines
840 B
Nix
{ fetchurl, buildDotnetPackage, unzip }:
|
|
|
|
attrs @
|
|
{ pname
|
|
, version
|
|
, url ? "https://www.nuget.org/api/v2/package/${pname}/${version}"
|
|
, sha256 ? ""
|
|
, md5 ? ""
|
|
, ...
|
|
}:
|
|
if md5 != "" then
|
|
throw "fetchnuget does not support md5 anymore, please use sha256"
|
|
else
|
|
buildDotnetPackage ({
|
|
src = fetchurl {
|
|
inherit url sha256;
|
|
name = "${pname}.${version}.zip";
|
|
};
|
|
|
|
sourceRoot = ".";
|
|
|
|
nativeBuildInputs = [ unzip ];
|
|
|
|
dontBuild = true;
|
|
|
|
preInstall = ''
|
|
function traverseRename () {
|
|
for e in *
|
|
do
|
|
t="$(echo "$e" | sed -e "s/%20/\ /g" -e "s/%2B/+/g")"
|
|
[ "$t" != "$e" ] && mv -vn "$e" "$t"
|
|
if [ -d "$t" ]
|
|
then
|
|
cd "$t"
|
|
traverseRename
|
|
cd ..
|
|
fi
|
|
done
|
|
}
|
|
|
|
traverseRename
|
|
'';
|
|
} // attrs)
|