Home Posts Links Notes Now

NixOS cleanup

2024-05-30T20:00:00

To see what's kept around (and what's keeping it around) run nix-store --gc --print-roots. Roots belonging to old generations can be removed by running nix-env --delete-generations 14d.

To cleanup there are two different commands. I still need to fully understand what's the difference (if any):

GC can be automated adding this to the configuation:

{
    nix = {
    settings.trusted-users = [ "nixos" ];
    gc = {
      automatic = true;
      dates = "weekly";
      options = "--delete-older-than 7d";
    };
  };
}

Thanks for reading. Feel free to reach out for any comment or question.