My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/infra/libkookie/nixpkgs/unstable/pkgs/build-support/fetchnuget/default.nix

43 lines
849 B

{ fetchurl, buildDotnetPackage, unzip }:
attrs @
{ baseName
, version
, url ? "https://www.nuget.org/api/v2/package/${baseName}/${version}"
, sha256 ? ""
, md5 ? ""
, ...
}:
if md5 != "" then
throw "fetchnuget does not support md5 anymore, please use sha256"
else
buildDotnetPackage ({
src = fetchurl {
inherit url sha256;
name = "${baseName}.${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)