this repo has no description

Compare changes

Choose any two refs to compare.

Changed files
+60 -124
+59 -123
fetcher.nix
··· 4 5 { 6 lib, 7 - repoRevToNameMaybe, 8 - fetchgit, 9 - fetchzip, 10 }: 11 12 lib.makeOverridable ( 13 - { 14 - domain ? "tangled.org", 15 - owner, 16 - repo, 17 - rev ? null, 18 - tag ? null, 19 - 20 - # TODO: add back when doing FP 21 - # name ? repoRevToNameMaybe repo (lib.revOrTag rev tag) "tangled", 22 - 23 - # fetchgit stuff 24 - fetchSubmodules ? false, 25 - leaveDotGit ? false, 26 - deepClone ? false, 27 - forceFetchGit ? false, 28 - fetchLFS ? false, 29 - sparseCheckout ? [ ], 30 - 31 - passthru ? { }, 32 - meta ? { }, 33 - ... 34 - }@args: 35 - 36 - assert lib.assertMsg (lib.xor (tag != null) ( 37 - rev != null 38 - )) "fetchFromTangled requires one of either `rev` or `tag` to be provided (not both)."; 39 - 40 - let 41 - 42 - position = ( 43 - if args.meta.description or null != null then 44 - builtins.unsafeGetAttrPos "description" args.meta 45 - else if tag != null then 46 - builtins.unsafeGetAttrPos "tag" args 47 - else 48 - builtins.unsafeGetAttrPos "rev" args 49 - ); 50 - 51 - baseUrl = "https://${domain}/${owner}/${repo}"; 52 - 53 - newMeta = 54 - meta 55 - // { 56 - homepage = meta.homepage or baseUrl; 57 - } 58 - // lib.optionalAttrs (position != null) { 59 - # to indicate where derivation originates, similar to make-derivation.nix's mkDerivation 60 - position = "${position.file}:${toString position.line}"; 61 - }; 62 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 != [ ]); 75 - 76 - # We prefer fetchzip in cases we don't need submodules as the hash 77 - # is more stable in that case. 78 - fetcher = 79 - if useFetchGit then 80 - fetchgit 81 - # fetchzip may not be overridable when using external tools, for example nix-prefetch 82 - else if fetchzip ? override then 83 - fetchzip.override { withUnzip = false; } 84 - else 85 - fetchzip; 86 - 87 - fetcherArgs = 88 finalAttrs: 89 - passthruAttrs 90 - // ( 91 - if useFetchGit then 92 - { 93 - inherit 94 - tag 95 - rev 96 - deepClone 97 - fetchSubmodules 98 - sparseCheckout 99 - fetchLFS 100 - leaveDotGit 101 - ; 102 - url = baseUrl; 103 - inherit passthru; 104 - derivationArgs = { 105 - inherit 106 - domain 107 - owner 108 - repo 109 - ; 110 - }; 111 } 112 - else 113 let 114 revWithTag = finalAttrs.rev; 115 in 116 { 117 url = "${baseUrl}/archive/${revWithTag}"; 118 extension = "tar.gz"; 119 120 - derivationArgs = { 121 - inherit 122 - domain 123 - owner 124 - repo 125 - tag 126 - ; 127 - rev = fetchgit.getRevWithTag { 128 - inherit (finalAttrs) tag; 129 - rev = finalAttrs.revCustom; 130 - }; 131 - revCustom = rev; 132 - }; 133 - 134 - passthru = { 135 - gitRepoUrl = baseUrl; 136 - } 137 - // passthru; 138 - } 139 - ) 140 - // { 141 - name = 142 - args.name 143 - or (repoRevToNameMaybe finalAttrs.repo (lib.revOrTag finalAttrs.revCustom finalAttrs.tag) "github"); 144 meta = newMeta; 145 }; 146 - in 147 - 148 - fetcher fetcherArgs 149 )
··· 4 5 { 6 lib, 7 + fetchFromGitProvider, 8 }: 9 10 lib.makeOverridable ( 11 + lib.extendMkDerivation { 12 + constructDrv = fetchFromGitProvider; 13 14 + excludeDrvArgNames = [ 15 "domain" 16 "owner" 17 + 18 + "useFetchGit" 19 ]; 20 21 + extendDrvArgs = 22 finalAttrs: 23 + { 24 + domain ? "tangled.org", 25 + owner, 26 + repo, 27 + rev ? null, 28 + tag ? null, 29 + passthru ? { }, 30 + meta ? { }, 31 + ... 32 + }@args: 33 + 34 + let 35 + 36 + position = ( 37 + if args.meta.description or null != null then 38 + builtins.unsafeGetAttrPos "description" args.meta 39 + else if tag != null then 40 + builtins.unsafeGetAttrPos "tag" args 41 + else 42 + builtins.unsafeGetAttrPos "rev" args 43 + ); 44 + 45 + baseUrl = "https://${domain}/${owner}/${repo}"; 46 + 47 + newMeta = 48 + meta 49 + // { 50 + homepage = meta.homepage or baseUrl; 51 } 52 + // lib.optionalAttrs (position != null) { 53 + # to indicate where derivation originates, similar to make-derivation.nix's mkDerivation 54 + position = "${position.file}:${toString position.line}"; 55 + }; 56 + 57 + in 58 + 59 + { 60 + providerName = "tangled"; 61 + 62 + derivationArgs = { 63 + inherit 64 + domain 65 + owner 66 + ; 67 + }; 68 + 69 + inherit repo; 70 + 71 + gitRepoUrl = baseUrl; 72 + 73 + fetchZipArgs = 74 let 75 revWithTag = finalAttrs.rev; 76 in 77 { 78 url = "${baseUrl}/archive/${revWithTag}"; 79 extension = "tar.gz"; 80 + }; 81 82 meta = newMeta; 83 }; 84 + } 85 )
+1 -1
flake.nix
··· 1 { 2 inputs = { 3 - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 4 }; 5 6 outputs =
··· 1 { 2 inputs = { 3 + nixpkgs.url = "github:nixos/nixpkgs/pull/462034/head"; 4 }; 5 6 outputs =