fetchNuGet: add SRI hash support

This commit is contained in:
aleksana 2024-07-04 17:33:34 +08:00
parent 3c89ee1b7b
commit 9aee77e045

View File

@ -5,15 +5,19 @@ attrs @
, version
, url ? "https://www.nuget.org/api/v2/package/${pname}/${version}"
, sha256 ? ""
, hash ? ""
, md5 ? ""
, ...
}:
if md5 != "" then
throw "fetchnuget does not support md5 anymore, please use sha256"
throw "fetchnuget does not support md5 anymore, please use 'hash' attribute with SRI hash"
# This is also detected in fetchurl, but we just throw here to avoid confusion
else if (sha256 != "" && hash != "") then
throw "multiple hashes passed to fetchNuGet"
else
buildDotnetPackage ({
src = fetchurl {
inherit url sha256;
inherit url sha256 hash;
name = "${pname}.${version}.zip";
};