Files
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

91 lines
1.8 KiB
Nix

{
lib,
stdenvNoCC,
buildPackages,
cacert,
subversion,
glibcLocales,
sshSupport ? true,
openssh ? null,
}:
let
repoToName =
url: rev:
let
inherit (lib)
removeSuffix
splitString
reverseList
head
last
elemAt
;
base = removeSuffix "/" (last (splitString ":" url));
path = reverseList (splitString "/" base);
repoName =
# ../repo/trunk -> repo
if head path == "trunk" then
elemAt path 1
# ../repo/branches/branch -> repo-branch
else if elemAt path 1 == "branches" then
"${elemAt path 2}-${head path}"
# ../repo/tags/tag -> repo-tag
else if elemAt path 1 == "tags" then
"${elemAt path 2}-${head path}"
# ../repo (no trunk) -> repo
else
head path;
in
"${repoName}-r${toString rev}";
in
{
url,
rev ? "HEAD",
name ? repoToName url rev,
sha256 ? "",
hash ? "",
ignoreExternals ? false,
ignoreKeywords ? false,
preferLocalBuild ? true,
}:
assert sshSupport -> openssh != null;
if hash != "" && sha256 != "" then
throw "Only one of sha256 or hash can be set"
else
stdenvNoCC.mkDerivation {
inherit name;
builder = ./builder.sh;
nativeBuildInputs = [
cacert
subversion
glibcLocales
]
++ lib.optional sshSupport openssh;
SVN_SSH = if sshSupport then "${buildPackages.openssh}/bin/ssh" else null;
outputHashAlgo = if hash != "" then null else "sha256";
outputHashMode = "recursive";
outputHash =
if hash != "" then
hash
else if sha256 != "" then
sha256
else
lib.fakeSha256;
inherit
url
rev
ignoreExternals
ignoreKeywords
;
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
inherit preferLocalBuild;
}