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.
This commit is contained in:
Marien Zwart 2024-08-17 14:13:26 +10:00
parent 7f0ff43156
commit 52b9927fff
No known key found for this signature in database
2 changed files with 4 additions and 16 deletions

View file

@ -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 (