core/pkgs/build-support/dotnet/fetchnuget/default.nix

51 lines
913 B
Nix
Raw Normal View History

2024-06-30 08:16:52 +00:00
{
fetchurl,
buildDotnetPackage,
unzip,
}:
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
attrs@{
pname,
version,
url ? "https://www.nuget.org/api/v2/package/${pname}/${version}",
sha256 ? "",
md5 ? "",
...
2024-05-02 00:46:19 +00:00
}:
if md5 != "" then
throw "fetchnuget does not support md5 anymore, please use sha256"
else
2024-06-30 08:16:52 +00:00
buildDotnetPackage (
{
src = fetchurl {
inherit url sha256;
name = "${pname}.${version}.zip";
};
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
sourceRoot = ".";
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
nativeBuildInputs = [ unzip ];
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
dontBuild = true;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
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
}
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
traverseRename
'';
}
// attrs
)