this repo has no description

Compare changes

Choose any two refs to compare.

Changed files
+57 -33
+57 -33
fetcher.nix
··· 9 9 fetchzip, 10 10 }: 11 11 12 - lib.makeOverridable ( 12 + let 13 + 14 + useFetchGitArgsDefault = { 15 + deepClone = false; 16 + fetchSubmodules = false; # This differs from fetchgit's default 17 + fetchLFS = false; 18 + forceFetchGit = false; 19 + leaveDotGit = null; 20 + rootDir = ""; 21 + sparseCheckout = null; 22 + }; 23 + useFetchGitArgsDefaultNullable = { 24 + leaveDotGit = false; 25 + sparseCheckout = [ ]; 26 + }; 27 + useFetchGitargsDefaultNonNull = useFetchGitArgsDefault // useFetchGitArgsDefaultNullable; 28 + excludeUseFetchGitArgNames = [ 29 + "forceFetchGit" 30 + ]; 31 + 32 + faUseFetchGit = lib.mapAttrs (_: _: true) useFetchGitArgsDefault; 33 + 34 + adjustFunctionArgs = f: lib.setFunctionArgs f (faUseFetchGit // lib.functionArgs f); 35 + 36 + decorate = f: lib.makeOverridable (adjustFunctionArgs f); 37 + 38 + in 39 + 40 + decorate ( 13 41 { 14 42 domain ? "tangled.org", 15 43 owner, ··· 20 48 # TODO: add back when doing FP 21 49 # name ? repoRevToNameMaybe repo (lib.revOrTag rev tag) "tangled", 22 50 23 - # fetchgit stuff 24 - fetchSubmodules ? false, 25 - leaveDotGit ? false, 26 - deepClone ? false, 27 - forceFetchGit ? false, 28 - fetchLFS ? false, 29 - sparseCheckout ? [ ], 30 - 31 51 passthru ? { }, 32 52 meta ? { }, 33 53 ... ··· 39 59 40 60 let 41 61 62 + useFetchGit = 63 + lib.mapAttrs ( 64 + name: nonNullDefault: 65 + if args ? ${name} && (useFetchGitArgsDefaultNullable ? ${name} -> args.${name} != null) then 66 + args.${name} 67 + else 68 + nonNullDefault 69 + ) useFetchGitargsDefaultNonNull != useFetchGitargsDefaultNonNull; 70 + useFetchGitArgsWDPassing = lib.overrideExisting (removeAttrs useFetchGitArgsDefault excludeUseFetchGitArgNames) args; 71 + 42 72 position = ( 43 73 if args.meta.description or null != null then 44 74 builtins.unsafeGetAttrPos "description" args.meta ··· 60 90 position = "${position.file}:${toString position.line}"; 61 91 }; 62 92 63 - passthruAttrs = removeAttrs args [ 64 - "domain" 65 - "owner" 66 - "repo" 67 - "tag" 68 - "rev" 69 - "fetchSubmodules" 70 - "forceFetchGit" 71 - ]; 72 - 73 - useFetchGit = 74 - fetchSubmodules || leaveDotGit || deepClone || forceFetchGit || fetchLFS || (sparseCheckout != [ ]); 93 + passthruAttrs = removeAttrs args ( 94 + [ 95 + "domain" 96 + "owner" 97 + "repo" 98 + "tag" 99 + "rev" 100 + "fetchSubmodules" 101 + "forceFetchGit" 102 + ] 103 + ++ (if useFetchGit then excludeUseFetchGitArgNames else lib.attrNames faUseFetchGit) 104 + ); 75 105 76 106 # We prefer fetchzip in cases we don't need submodules as the hash 77 107 # is more stable in that case. ··· 89 119 passthruAttrs 90 120 // ( 91 121 if useFetchGit then 92 - { 93 - inherit 94 - tag 95 - rev 96 - deepClone 97 - fetchSubmodules 98 - sparseCheckout 99 - fetchLFS 100 - leaveDotGit 101 - ; 122 + useFetchGitArgsWDPassing 123 + // { 124 + inherit tag rev; 102 125 url = baseUrl; 103 126 inherit passthru; 104 127 derivationArgs = { ··· 139 162 ) 140 163 // { 141 164 name = 142 - args.name 143 - or (repoRevToNameMaybe finalAttrs.repo (lib.revOrTag finalAttrs.revCustom finalAttrs.tag) "github"); 165 + args.name or (repoRevToNameMaybe finalAttrs.repo (lib.revOrTag finalAttrs.revCustom finalAttrs.tag) 166 + "tangled" 167 + ); 144 168 meta = newMeta; 145 169 }; 146 170 in