Merge pull request #19 from marienz/fetch

Fix fetches with Nix 2.23's default shallow clones
This commit is contained in:
marienz 2024-07-02 22:40:13 +10:00 committed by GitHub
commit 4fc2df24bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 2 deletions

View file

@ -59,7 +59,7 @@
}: }:
let let
inherit (lib) optionalAttrs optionalString; inherit (lib) optionalAttrs optionalString;
inherit (import ./fetch-overrides.nix) extraPins extraUrls; inherit (import ./fetch-overrides.nix) extraPins extraUrls forceDeepCloneDomains;
# Step 1: determine which Emacs packages to pull in. # Step 1: determine which Emacs packages to pull in.
# #
@ -260,7 +260,10 @@ let
} }
// optionalAttrs (p ? recipe.branch) { ref = p.recipe.branch; } // optionalAttrs (p ? recipe.branch) { ref = p.recipe.branch; }
// optionalAttrs (p ? recipe.depth) { shallow = p.recipe.depth == 1; }; // optionalAttrs (p ? recipe.depth) { shallow = p.recipe.depth == 1; }
// optionalAttrs (lib.any (d: lib.hasPrefix d url) forceDeepCloneDomains) {
shallow = false;
};
src = src =
if experimentalFetchTree if experimentalFetchTree
then builtins.fetchTree ( then builtins.fetchTree (
@ -274,6 +277,16 @@ let
type = "github"; type = "github";
inherit owner repo; inherit owner repo;
rev = pin; rev = pin;
} else if lib.hasPrefix "https://git.sr.ht/" url
then let
tail = lib.removePrefix "https://git.sr.ht/" url;
split = lib.splitString "/" tail;
owner = lib.head split;
repo = lib.elemAt split 1;
in {
type = "sourcehut";
inherit owner repo;
rev = pin;
} else ({ } else ({
type = "git"; type = "git";
} // fetchGitArgs)) } // fetchGitArgs))

View file

@ -54,4 +54,12 @@
# CI should fail again the next time Doom updates magit, so this won't go stale. # CI should fail again the next time Doom updates magit, so this won't go stale.
git-commit = "ea0f07e54967197ac0b072a69ba314314a4080c1"; git-commit = "ea0f07e54967197ac0b072a69ba314314a4080c1";
}; };
# Domains for which to force `shallow = false`.
forceDeepCloneDomains = [
"https://git.notmuchmail.org/"
"https://git.savannah.gnu.org/"
"https://git.sr.ht/"
"https://codeberg.org/"
];
} }