Files
nixpkgs/pkgs/by-name/xr/xrootd/fetchxrd.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

49 lines
957 B
Nix

{
lib,
runCommandLocal,
xrootd,
}:
{
name ? "",
pname ? "",
version ? "",
urls ? [ ],
url ? if urls == [ ] then abort "Expect either non-empty `urls` or `url`" else builtins.head urls,
hash ? lib.fakeHash,
}:
(runCommandLocal name
{
nativeBuildInputs = [ xrootd ];
outputHashAlgo = null;
outputHashMode = "flat";
outputHash = hash;
inherit url;
urls = if urls == [ ] then lib.singleton url else urls;
}
''
for u in $urls; do
xrdcp --verbose --force "$u" "$out"
ret=$?
(( ret != 0 )) || break
done
if (( ret )); then
echo "xrdcp failed trying to download any of the urls" >&2
exit $ret
fi
''
).overrideAttrs
(
finalAttrs:
if (pname != "" && version != "") then
{
inherit pname version;
name = "${pname}-${version}";
}
else
{
name = if (name != "") then name else (baseNameOf finalAttrs.url);
}
)