Reduce Cachix closure size
As discussed, currently, cachix.enable is true by default, causing an extra 5.5 GiB to land in the Nix store. Considering the Cachix package in nixpkgs is ~125 MiB, that seems a bit excessive.
From Matrix:
we're including cachix there, although we call lib.getBin, I think the general way we assemble the packages it still includes all outputs
I think there must be code, somewhere beyond mkShell and probably in mkDerivation, that's traversing all of the outputs of derivations added to nativeBuildInputs. Using pkgs.cachix.bin or lib.getBin is not enough. This works:
let
pkg = pkgs.cachix.bin;
res = {
type = "derivation";
name = pkg.name;
outPath = pkg.outPath;
outputs = [ "out" ];
out = res;
outputName = "out";
};
in res
~Maybe we need to remove propagatedBuildInputs?~ Nope
We should really take a look at this one.
This might get solved by https://github.com/NixOS/nixpkgs/pull/466253
@VictorEngmarkHexagon can you confirm if it's fixed with recent nixpkgs?
@VictorEngmarkHexagon can you confirm if it's fixed with recent nixpkgs?
I'm not sure how to test it in isolation. I tried this:
-
devenv initin a new directory - Add
cachix.enable = true;todevenv.nix -
nix-tree $DEVENV_PROFILE
But that doesn't show cachix anywhere in the tree.
The large doc output has been removed from cachix in nixpkgs-unstable. I'll bump devenv-nixpkgs early next week, at which point we can consider this resolved (at least for cachix).