devenv icon indicating copy to clipboard operation
devenv copied to clipboard

Reduce Cachix closure size

Open VictorEngmarkHexagon opened this issue 1 year ago • 8 comments

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.

VictorEngmarkHexagon avatar Apr 15 '25 12:04 VictorEngmarkHexagon

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

domenkozar avatar Apr 15 '25 12:04 domenkozar

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

sandydoo avatar Apr 22 '25 15:04 sandydoo

~Maybe we need to remove propagatedBuildInputs?~ Nope

sandydoo avatar Apr 22 '25 15:04 sandydoo

We should really take a look at this one.

domenkozar avatar Nov 22 '25 16:11 domenkozar

This might get solved by https://github.com/NixOS/nixpkgs/pull/466253

domenkozar avatar Dec 01 '25 11:12 domenkozar

@VictorEngmarkHexagon can you confirm if it's fixed with recent nixpkgs?

domenkozar avatar Dec 10 '25 15:12 domenkozar

@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 init in a new directory
  • Add cachix.enable = true; to devenv.nix
  • nix-tree $DEVENV_PROFILE

But that doesn't show cachix anywhere in the tree.

VictorEngmarkHexagon avatar Dec 17 '25 12:12 VictorEngmarkHexagon

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).

sandydoo avatar Dec 17 '25 17:12 sandydoo