@@ -198,19 +198,10 @@ with pkgs;
198198 baseUrl = "https://${githubBase}/${owner}/${repo}";
199199 passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "private" "githubBase" "varPrefix" ];
200200 varBase = "NIX${if varPrefix == null then "" else "_${varPrefix}"}_GITHUB_PRIVATE_";
201− in if fetchSubmodules then
202− fetchgit ({
203− inherit name rev fetchSubmodules;
204− url = "${baseUrl}.git";
205− } // passthruAttrs)
206− else
207201 # We prefer fetchzip in cases we don't need submodules as the hash
208202 # is more stable in that case.
209− fetchzip ({
210− inherit name;
211− url = "${baseUrl}/archive/${rev}.tar.gz";
212− meta.homepage = "${baseUrl}/";
213− } // lib.optionalAttrs private {
203+ fetcher = if fetchSubmodules then fetchgit else fetchzip;
204+ privateAttrs = lib.optionalAttrs private {
214205 netrcPhase = ''
215206 if [ -z "''$${varBase}USERNAME" -o -z "''$${varBase}PASSWORD" ]; then
216207 echo "Error: Private fetchFromGitHub requires the nix building process (nix-daemon in multi user mode) to have the ${varBase}USERNAME and ${varBase}PASSWORD env vars set." >&2
@@ -223,7 +214,12 @@ with pkgs;
223214 EOF
224215 '';
225216 netrcImpureEnvVars = [ "${varBase}USERNAME" "${varBase}PASSWORD" ];
226− } // passthruAttrs) // { inherit rev; };
217+ };
218+ fetcherArgs = (if fetchSubmodules
219+ then { inherit rev fetchSubmodules; url = "${baseUrl}.git"; }
220+ else ({ url = "${baseUrl}/archive/${rev}.tar.gz"; } // privateAttrs)
221+ ) // passthruAttrs // { inherit name; };
222+ in fetcher fetcherArgs // { meta.homepage = baseUrl; inherit rev; };
227223
228224 fetchFromBitbucket = {
229225 owner, repo, rev, name ? gitRepoToName repo rev,