feat: add NixOS auto-GC and -store optimisation

This commit is contained in:
Swarsel 2024-07-11 11:08:22 +02:00
parent 88f64a3139
commit af3224a1d5
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
2 changed files with 39 additions and 0 deletions

View file

@ -4660,6 +4660,33 @@ Needed for control over system-wide privileges etc.
#+end_src
**** Enable automatic garbage collection
The nix store fills up over time, until =/boot/efi= is filled. This snippet cleans it automatically on a weekly basis.
#+begin_src nix :tangle profiles/common/nixos.nix
nix.gc = {
automatic = true;
randomizedDelaySec = "14m";
dates = "weekly";
options = "--delete-older-than 10d";
};
#+end_src
**** Enable automatic store optimisation
This enables hardlinking identical files in the nix store, to save on disk space. I have read this incurs a significant I/O overhead, I need to keep an eye on this.
#+begin_src nix :tangle profiles/common/nixos.nix
nix.optimise = {
automatic = true;
dates = [ "weekly" ];
};
#+end_src
**** Reduce systemd timeouts
:PROPERTIES:

View file

@ -32,6 +32,18 @@ stylix.targets.grub.enable = false; # the styling makes grub more ugly
security.polkit.enable = true;
nix.gc = {
automatic = true;
randomizedDelaySec = "14m";
dates = "weekly";
options = "--delete-older-than 10d";
};
nix.optimise = {
automatic = true;
dates = [ "weekly" ];
};
# systemd
systemd.extraConfig = ''
DefaultTimeoutStartSec=60s