From 52b9927fff3b156df87735a7621099fbfcfab522 Mon Sep 17 00:00:00 2001 From: Marien Zwart Date: Sat, 17 Aug 2024 14:13:26 +1000 Subject: [PATCH] Never do shallow fetches They seem to generally not work if the rev we're fetching is not current. That failure mode is particularly problematic because already having the rev cached avoids the failure: fetches work initially, when the pinned commit is the current one, then break after upstream commits. I could disable repository caching in CI, but that would turn it into a game of whack-a-mole: this breaks on upstream repository commits, not flake updates. The downside is increased disk usage. This can be partially mitigated by enabling experimentalFetchTree, which fetches snapshots. Force shallow false to work around https://github.com/NixOS/nix/issues/11012 (Nix 2.23 default to shallow fetches). We should be able to remove that if Nix adds the fallback they're planning to add. Hopefully fixes #14 once and for all. --- default.nix | 10 ++++------ fetch-overrides.nix | 10 ---------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/default.nix b/default.nix index d35351c..fb32034 100644 --- a/default.nix +++ b/default.nix @@ -59,7 +59,7 @@ }: let inherit (lib) optionalAttrs optionalString; - inherit (import ./fetch-overrides.nix) extraPins extraUrls forceDeepCloneDomains; + inherit (import ./fetch-overrides.nix) extraPins extraUrls; # Step 1: determine which Emacs packages to pull in. # @@ -261,12 +261,10 @@ let # Note Doom does have packages with pin + branch (or nonrecursive) set, # expecting to inherit the rest of the recipe from Straight. - } - // optionalAttrs (p ? recipe.branch) { ref = p.recipe.branch; } - // optionalAttrs (p ? recipe.depth) { shallow = p.recipe.depth == 1; } - // optionalAttrs (lib.any (d: lib.hasPrefix d url) forceDeepCloneDomains) { + # TODO: remove if https://github.com/NixOS/nix/issues/11012 is fixed. shallow = false; - }; + } + // optionalAttrs (p ? recipe.branch) { ref = p.recipe.branch; }; src = if experimentalFetchTree then builtins.fetchTree ( diff --git a/fetch-overrides.nix b/fetch-overrides.nix index d0e68d4..81e438b 100644 --- a/fetch-overrides.nix +++ b/fetch-overrides.nix @@ -42,14 +42,4 @@ # In emacsattic, so shouldn't change underneath us. ammonite-term-repl = "b552fe21977e005c1c460bf6607557e67241a6b6"; }; - - # Domains for which to force `shallow = false`. - forceDeepCloneDomains = [ - "https://git.notmuchmail.org/" - "https://git.savannah.gnu.org/" - "https://git.sr.ht/" - "https://codeberg.org/" - "https://gitlab.com/" - "https://repo.or.cz/" - ]; }