diff --git a/default.nix b/default.nix index c6be253..d199087 100644 --- a/default.nix +++ b/default.nix @@ -59,7 +59,7 @@ }: let 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. # @@ -260,7 +260,10 @@ let } // 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 = if experimentalFetchTree then builtins.fetchTree ( @@ -274,6 +277,16 @@ let type = "github"; inherit owner repo; 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 ({ type = "git"; } // fetchGitArgs)) diff --git a/fetch-overrides.nix b/fetch-overrides.nix index 6da2a83..eb989ef 100644 --- a/fetch-overrides.nix +++ b/fetch-overrides.nix @@ -54,4 +54,12 @@ # CI should fail again the next time Doom updates magit, so this won't go stale. 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/" + ]; }