Skip to content

Commit

Permalink
CI: micro-optimize cachix build
Browse files Browse the repository at this point in the history
The doom profile is a non-negligible fraction of the cachix binary size,
that will only get worse (any dependency change will trigger a rebuild),
and caching them is essentially useless.

Expose emacsWithPackages so we can push just that. Skip
emacsWithPackages itself and push just the -deps derivation while we're
at it: caching either emacsWithPackages or -deps is similarly useless,
but they are a bit smaller.

When I say "non-negligible", it's about 1 MiB per "full" profile: much
larger than most individual libraries but not actually large. So this is
really a micro-optimization.
  • Loading branch information
marienz committed May 23, 2024
1 parent 23156c4 commit edf33cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ let
# Use runCommand, not runCommandLocal, because makeBinaryWrapper pulls in a compiler.
doomEmacs = runCommand "doom-emacs" {
nativeBuildInputs = [ makeBinaryWrapper ];
# Expose this so we can push it to cachix.
inherit emacsWithPackages;
} ''
if [[ -z "${profileName}" ]]; then
profileArgs=()
Expand Down
3 changes: 2 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@
}).doomEmacs;
# TODO: cache more packages, cache for more Emacsen.
cachix-packages = pkgs.linkFarm "unstraightened-cachix-packages" {
inherit doomemacs;
full-emacs29 = (doomFromPackages pkgs {
emacs = pkgs.emacs29;
doomDir = ./doomdirs/minimal;
doomLocalDir = "~/.local/share/nix-doom-unstraightened";
full = true;
}).doomEmacs;
}).doomEmacs.emacsWithPackages.deps;
};
});
overlays.default = final: prev: {
Expand Down

0 comments on commit edf33cf

Please sign in to comment.