1
0
Fork 0

General: Switch back to default Nix garbage collect & optimization

This commit is contained in:
Aires 2024-07-29 17:31:28 -04:00
parent 54559104b1
commit b18788a9eb
2 changed files with 14 additions and 10 deletions

View file

@ -19,13 +19,6 @@
nh = {
enable = true;
flake = "${config.secrets.nixConfigFolder}";
# Alternative garbage collection system to nix.gc.automatic
clean = {
enable = true;
dates = "weekly"; # Runs at 12:00 AM on Mondays
extraArgs = "--keep-since 14d --keep 10"; # By default, keep the last 10 entries (or two weeks) of generations
};
};
# Do some additional Nano configuration
nano.nanorc = ''

View file

@ -14,9 +14,9 @@ in
options = {
aux.system.allowUnfree = lib.mkEnableOption (lib.mdDoc "Allow unfree packages to install.");
aux.system.retentionPeriod = lib.mkOption {
description = "How long to retain NixOS generations. Defaults to 30 days (30d).";
description = "How long to retain NixOS generations. Defaults to one month.";
type = lib.types.str;
default = "30d";
default = "monthly";
};
};
config = {
@ -46,7 +46,18 @@ in
};
# Enable periodic nix store optimization
optimise.automatic = true;
optimise = {
automatic = true;
dates = [ "daily" ];
};
# Enable garbage collection
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than ${cfg.retentionPeriod}";
persistent = true;
randomizedDelaySec = "1hour";
};
# Configure NixOS to use the same software channel as Flakes
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;