nixos/modules/shell/nix/optimization.nix

31 lines
794 B
Nix
Raw Normal View History

2023-07-27 19:36:55 +04:00
{ inputs, options, config, lib, pkgs, ...}:
# this automatically optimizes stuff like nix-store
# and cleans out garbage weekly
# also limits generations
with lib;
let cfg = config.modules.shell.nix.optimize;
in
{
options.modules.shell.nix.optimize = {
enable = mkEnableOption false;
};
config = mkIf cfg.enable {
nix = {
# garbage collection
gc = {
automatic = true;
dates = "weekly";
2024-07-07 21:49:55 +04:00
options = "--delete-older-than 14d";
2023-07-27 19:36:55 +04:00
};
# optimizes store to reduce storage space :)
# does do alot on the cpu though :p
# shouldnt be a problem on high core cpus
# but might be a little problem on
# low end machines
# who cares though free storage woohoo
settings.auto-optimise-store = true;
};
};
}