about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authoraleksana <me@aleksana.moe>2024-07-04 17:33:34 +0800
committeraleksana <me@aleksana.moe>2024-07-04 17:33:34 +0800
commit9aee77e0453ce7335bf6a64d437acd46d30b1f28 (patch)
treedcb8a5a96cf651912de7735ee58ac57769ddc31c /pkgs/build-support
parent3c89ee1b7bc3121a8f7d2303163e45320bb75eba (diff)
fetchNuGet: add SRI hash support
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/dotnet/fetchnuget/default.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkgs/build-support/dotnet/fetchnuget/default.nix b/pkgs/build-support/dotnet/fetchnuget/default.nix
index 061da746cead0..a8e85270e73fa 100644
--- a/pkgs/build-support/dotnet/fetchnuget/default.nix
+++ b/pkgs/build-support/dotnet/fetchnuget/default.nix
@@ -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";
     };