1 { lib, stdenvNoCC, buildPackages
2 , subversion, glibcLocales, sshSupport ? true, openssh ? null
5 { url, rev ? "HEAD", sha256 ? "", hash ? ""
6 , ignoreExternals ? false, ignoreKeywords ? false, name ? null
7 , preferLocalBuild ? true
10 assert sshSupport -> openssh != null;
16 snd = l: lib.head (lib.tail l);
17 trd = l: lib.head (lib.tail (lib.tail l));
19 (p: if lib.head p == "" then lib.tail p else p) # ~ drop final slash if any
20 (lib.reverseList (lib.splitString "/" url));
21 path = [ (lib.removeSuffix "/" (lib.head path_)) ] ++ (lib.tail path_);
23 # ../repo/trunk -> repo
24 if fst path == "trunk" then snd path
25 # ../repo/branches/branch -> repo-branch
26 else if snd path == "branches" then "${trd path}-${fst path}"
27 # ../repo/tags/tag -> repo-tag
28 else if snd path == "tags" then "${trd path}-${fst path}"
29 # ../repo (no trunk) -> repo
32 name_ = if name == null then "${repoName}-r${toString rev}" else name;
35 if hash != "" && sha256 != "" then
36 throw "Only one of sha256 or hash can be set"
38 stdenvNoCC.mkDerivation {
40 builder = ./builder.sh;
41 nativeBuildInputs = [ subversion glibcLocales ]
42 ++ lib.optional sshSupport openssh;
44 SVN_SSH = if sshSupport then "${buildPackages.openssh}/bin/ssh" else null;
46 outputHashAlgo = if hash != "" then null else "sha256";
47 outputHashMode = "recursive";
48 outputHash = if hash != "" then
50 else if sha256 != "" then
55 inherit url rev ignoreExternals ignoreKeywords;
57 impureEnvVars = lib.fetchers.proxyImpureEnvVars;
58 inherit preferLocalBuild;