Use fetchTree / github fetcher for CI
This seems to be much more space-efficient: ~/.cache/nix/tarball-cache is about 700MiB uncompressed, under 300MiB as tzst (using tar's defaults, CI uses zstdmt but I assume will be in the same ballpark). The gitv3 cache is multiple GiB. CI will still build doom-example using fetchGit. I intend to shrink the number of modules enabled in the example to keep gitv3 cache size under control.
This commit is contained in:
parent
645f79a916
commit
2af26fcfa1
3 changed files with 37 additions and 20 deletions
|
|
@ -31,6 +31,7 @@ let
|
|||
# TODO: drop after NixOS 24.05 release.
|
||||
emacs = emacs29;
|
||||
doomLocalDir = "~/.local/share/nix-doom-unstraightened";
|
||||
experimentalFetchTree = true;
|
||||
};
|
||||
mkDoom = args: (makeDoomPackages (common // args)).doomEmacs;
|
||||
mkDoomDir = args: writeTextDir "init.el" (toInit args);
|
||||
|
|
|
|||
27
default.nix
27
default.nix
|
|
@ -39,6 +39,8 @@
|
|||
profileName ? "nix",
|
||||
/* Disable profile early in startup, so "normal" cache/state dirs are used. */
|
||||
noProfileHack ? false,
|
||||
/* Use fetchTree instead of fetchGit for package fetches. */
|
||||
experimentalFetchTree ? false,
|
||||
|
||||
callPackages,
|
||||
git,
|
||||
|
|
@ -233,10 +235,7 @@ let
|
|||
else (throw "${name}: cannot derive url from recipe ${p.recipe or "<missing>"}"));
|
||||
# Use builtins.fetchGit instead of nixpkgs's fetchFromGitHub because
|
||||
# fetchGit allows fetching a specific git commit without a hash.
|
||||
# TODO: port to fetchTree once (mostly) stable
|
||||
# (in particular the github fetcher may be noticably more efficient)
|
||||
src = builtins.fetchGit (
|
||||
{
|
||||
fetchGitArgs = {
|
||||
inherit url;
|
||||
rev = pin;
|
||||
allRefs = true;
|
||||
|
|
@ -252,8 +251,24 @@ let
|
|||
# Always specify a ref to work around https://github.com/NixOS/nix/issues/10773
|
||||
ref = p.recipe.branch or "HEAD";
|
||||
}
|
||||
// optionalAttrs (p ? recipe.depth) { shallow = p.recipe.depth == 1; }
|
||||
);
|
||||
// optionalAttrs (p ? recipe.depth) { shallow = p.recipe.depth == 1; };
|
||||
src =
|
||||
if experimentalFetchTree
|
||||
then builtins.fetchTree (
|
||||
if lib.hasPrefix "https://github.com/" url
|
||||
then let
|
||||
tail = lib.removePrefix "https://github.com/" url;
|
||||
split = lib.splitString "/" tail;
|
||||
owner = lib.head split;
|
||||
repo = lib.removeSuffix ".git" (lib.elemAt split 1);
|
||||
in {
|
||||
type = "github";
|
||||
inherit owner repo;
|
||||
rev = pin;
|
||||
} else ({
|
||||
type = "git";
|
||||
} // fetchGitArgs))
|
||||
else builtins.fetchGit fetchGitArgs;
|
||||
# Run locally to avoid a network roundtrip.
|
||||
reqfile = runCommandLocal "${name}-deps" { } ''
|
||||
${lib.getExe emacs} -Q --batch --script \
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@
|
|||
doomDir = ./doomdirs/minimal;
|
||||
doomLocalDir = "~/.local/share/nix-doom-unstraightened";
|
||||
full = true;
|
||||
experimentalFetchTree = true;
|
||||
}).doomEmacs.emacsWithPackages.deps;
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue