Skip to content

Commit

Permalink
Never do shallow fetches
Browse files Browse the repository at this point in the history
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
NixOS/nix#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.
  • Loading branch information
marienz committed Aug 17, 2024
1 parent 7f0ff43 commit 52b9927
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
10 changes: 4 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -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 (
Expand Down
10 changes: 0 additions & 10 deletions fetch-overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
];
}

0 comments on commit 52b9927

Please sign in to comment.