fetchfossil: support SRI hashes

+16 -3
+16 -3
pkgs/build-support/fetchfossil/default.nix
··· 1 1 {stdenv, lib, fossil, cacert}: 2 2 3 - {name ? null, url, rev, sha256}: 3 + { name ? null 4 + , url 5 + , rev 6 + , sha256 ? "" 7 + , hash ? "" 8 + }: 4 9 10 + if hash != "" && sha256 != "" then 11 + throw "Only one of sha256 or hash can be set" 12 + else 5 13 stdenv.mkDerivation { 6 14 name = "fossil-archive" + (lib.optionalString (name != null) "-${name}"); 7 15 builder = ./builder.sh; ··· 11 19 # https://www.fossil-scm.org/index.html/doc/trunk/www/env-opts.md 12 20 impureEnvVars = [ "http_proxy" ]; 13 21 14 - outputHashAlgo = "sha256"; 22 + outputHashAlgo = if hash != "" then null else "sha256"; 15 23 outputHashMode = "recursive"; 16 - outputHash = sha256; 24 + outputHash = if hash != "" then 25 + hash 26 + else if sha256 != "" then 27 + sha256 28 + else 29 + lib.fakeSha256; 17 30 18 31 inherit url rev; 19 32 preferLocalBuild = true;