diff --git a/hosts/deertopia/configuration.nix b/hosts/deertopia/configuration.nix index cfbb5fc..f748d04 100644 --- a/hosts/deertopia/configuration.nix +++ b/hosts/deertopia/configuration.nix @@ -10,6 +10,7 @@ filesystemType = "btrfs"; stylix.enable = true; + gc.enable = true; openssh.enable = true; sydpkgs.overlay.enable = true; diff --git a/modules/nixos/gc.nix b/modules/nixos/gc.nix new file mode 100644 index 0000000..c7a66e8 --- /dev/null +++ b/modules/nixos/gc.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +let cfg = config.sydnix.gc; +in { + options.sydnix.gc = { + enable = lib.mkEnableOption "the automatic Nix garbage collector"; + }; + + config = lib.mkIf cfg.enable { + nix.gc = { + automatic = true; + randomizedDelaySec = "14m"; + options = "--delete-older-than 30d"; + }; + }; +}