From 5f53a024a37f6f6a664afdca95cd77508f28f2c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=B7=F0=90=91=91=F0=90=91=B4=F0=90=91=95=F0=90=91=91?= =?UTF-8?q?=F0=90=91=A9=F0=90=91=A4?= Date: Tue, 2 Dec 2025 23:21:59 +0700 Subject: [PATCH 1/2] fetchdarcs: remove remnant `--partial` --- pkgs/build-support/fetchdarcs/builder.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/fetchdarcs/builder.sh b/pkgs/build-support/fetchdarcs/builder.sh index e1c5d7745d35..8137209686b6 100644 --- a/pkgs/build-support/fetchdarcs/builder.sh +++ b/pkgs/build-support/fetchdarcs/builder.sh @@ -1,3 +1,5 @@ +set -u + tagtext="" tagflags="" # Darcs hashes are sha1 (120 bits, 40-character hex) @@ -12,7 +14,7 @@ elif test -n "$context"; then tagflags="--context=$context" fi -echo "Cloning $url $partial ${tagtext} into $out" +echo "Cloning $url ${tagtext} into $out" darcs clone --lazy $tagflags "$url" "$out" # remove metadata, because it can change From 2a1e98f0b2bf94d3100148d6c9744926c8235a43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=B7=F0=90=91=91=F0=90=91=B4=F0=90=91=95=F0=90=91=91?= =?UTF-8?q?=F0=90=91=A9=F0=90=91=A4?= Date: Tue, 2 Dec 2025 23:24:39 +0700 Subject: [PATCH 2/2] fetchdarcs: add mirror support --- pkgs/build-support/fetchdarcs/builder.sh | 19 +++++++++++++++---- pkgs/build-support/fetchdarcs/default.nix | 7 ++++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/pkgs/build-support/fetchdarcs/builder.sh b/pkgs/build-support/fetchdarcs/builder.sh index 8137209686b6..adc9c55939c3 100644 --- a/pkgs/build-support/fetchdarcs/builder.sh +++ b/pkgs/build-support/fetchdarcs/builder.sh @@ -14,8 +14,19 @@ elif test -n "$context"; then tagflags="--context=$context" fi -echo "Cloning $url ${tagtext} into $out" +# Repository list may contain ?. No glob expansion for that. +set -o noglob -darcs clone --lazy $tagflags "$url" "$out" -# remove metadata, because it can change -rm -rf "$out/_darcs" +for repository in $repositories; do + echo "Trying to clone $repository $tagtext into $out …" + if darcs clone --lazy $tagflags "$repository" "$out"; then + # remove metadata, because it can change + rm -rf "$out/_darcs" + exit 0 + fi +done + +set +o noglob + +echo "Error: couldn’t clone repository from any mirror" 1>&2 +exit 1 diff --git a/pkgs/build-support/fetchdarcs/default.nix b/pkgs/build-support/fetchdarcs/default.nix index 2d24ddaecbd4..d6a9093c76dc 100644 --- a/pkgs/build-support/fetchdarcs/default.nix +++ b/pkgs/build-support/fetchdarcs/default.nix @@ -8,7 +8,11 @@ lib.makeOverridable ( lib.fetchers.withNormalizedHash { } ( { + # Repository to fetch url, + # Additional list of repositories specifying alternative download + # location to be tried in order, if the prior repository failed to fetch. + mirrors ? [ ], rev ? null, context ? null, outputHash ? lib.fakeHash, @@ -27,11 +31,12 @@ lib.makeOverridable ( outputHashMode = "recursive"; inherit - url rev context name ; + + repositories = [ url ] ++ mirrors; } ) )