From 54209fcd9e50adfb7be203dd790e206dd8a11123 Mon Sep 17 00:00:00 2001 From: nicoo Date: Sun, 15 Sep 2024 22:13:29 +0000 Subject: [PATCH] fetchmtn: support `hash` attribute --- pkgs/build-support/fetchmtn/default.nix | 33 ++++++++++++------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/pkgs/build-support/fetchmtn/default.nix b/pkgs/build-support/fetchmtn/default.nix index 4aa134242aa7..de208b92193f 100644 --- a/pkgs/build-support/fetchmtn/default.nix +++ b/pkgs/build-support/fetchmtn/default.nix @@ -1,25 +1,24 @@ # You can specify some extra mirrors and a cache DB via options {lib, stdenvNoCC, monotone, defaultDBMirrors ? [], cacheDB ? "./mtn-checkout.db"}: -# dbs is a list of strings -# each is an url for sync -# selector is mtn selector, like h:org.example.branch -# -{name ? "mtn-checkout", dbs ? [], sha256 -, selector ? "h:" + branch, branch}: +lib.fetchers.withNormalizedHash { } ( + # dbs is a list of strings, each is an url for sync + # selector is mtn selector, like h:org.example.branch + {name ? "mtn-checkout", dbs ? [] + , outputHash, outputHashAlgo + , selector ? "h:" + branch, branch}: -stdenvNoCC.mkDerivation { - builder = ./builder.sh; - nativeBuildInputs = [monotone]; + stdenvNoCC.mkDerivation { + builder = ./builder.sh; + nativeBuildInputs = [monotone]; - outputHashAlgo = "sha256"; - outputHashMode = "recursive"; - outputHash = sha256; + inherit outputHash outputHashAlgo; + outputHashMode = "recursive"; - dbs = defaultDBMirrors ++ dbs; - inherit branch cacheDB name selector; + dbs = defaultDBMirrors ++ dbs; + inherit branch cacheDB name selector; - impureEnvVars = lib.fetchers.proxyImpureEnvVars; - -} + impureEnvVars = lib.fetchers.proxyImpureEnvVars; + } +)