diff --git a/hosts/vps-monitor/default.nix b/hosts/vps-monitor/default.nix index af385b3..0d751cd 100644 --- a/hosts/vps-monitor/default.nix +++ b/hosts/vps-monitor/default.nix @@ -21,6 +21,11 @@ boot.loader.grub.enable = true; services = { + gc = { + enable = true; + onlyCleanRoots = true; + }; + tailscale.enable = true; nebula.node = { diff --git a/hosts/vps-private/default.nix b/hosts/vps-private/default.nix index 547d9c1..c0065f2 100644 --- a/hosts/vps-private/default.nix +++ b/hosts/vps-private/default.nix @@ -25,6 +25,11 @@ boot.loader.systemd-boot.enable = true; services = { + gc = { + enable = true; + onlyCleanRoots = true; + }; + tailscale = { enable = true; exitNode.enable = true; diff --git a/hosts/vps-public/default.nix b/hosts/vps-public/default.nix index 1b5f0c3..a59538f 100644 --- a/hosts/vps-public/default.nix +++ b/hosts/vps-public/default.nix @@ -21,6 +21,11 @@ boot.loader.systemd-boot.enable = true; services = { + gc = { + enable = true; + onlyCleanRoots = true; + }; + tailscale.enable = true; nebula.node = { diff --git a/modules/system/services/gc.nix b/modules/system/services/gc.nix index 29b09ac..e162053 100644 --- a/modules/system/services/gc.nix +++ b/modules/system/services/gc.nix @@ -1,14 +1,26 @@ { config, lib, ... }: +let + cfg = config.custom.services.gc; +in { - options.custom.services.gc.enable = lib.mkEnableOption ""; + options.custom.services.gc = { + enable = lib.mkEnableOption ""; + onlyCleanRoots = lib.mkEnableOption ""; + }; - config = lib.mkIf config.custom.services.gc.enable { + config = lib.mkIf cfg.enable { programs.nh = { enable = true; clean = { enable = true; dates = "weekly"; - extraArgs = "--keep 10 --keep-since 7d"; + extraArgs = + [ + "--keep 10" + "--keep-since 7d" + (lib.optionalString cfg.onlyCleanRoots "--no-gc") + ] + |> lib.concatStringsSep " "; }; }; };