diff --git a/flake.nix b/flake.nix index 79f5e12..2c8937f 100644 --- a/flake.nix +++ b/flake.nix @@ -262,6 +262,7 @@ deploy-rs.packages.${pkgs.system}.default ]; }; + nixosModules.default = ./modules; packages.getpaper = pkgs.callPackage ./extra-packages/scripts/getpaper { }; } ); diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..9e79ce3 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./general.nix + ./nix.nix + ]; +} diff --git a/modules/general.nix b/modules/general.nix new file mode 100644 index 0000000..77faa3b --- /dev/null +++ b/modules/general.nix @@ -0,0 +1,28 @@ +{ lib, config, ... }: +let cfg = config.nodeconfig; in { + options.minimize = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Disable non-essential stuff"; + }; + + config = lib.mkIf cfg.minimize { + documentation = { + enable = lib.mkDefault false; + doc.enable = lib.mkDefault false; + info.enable = lib.mkDefault false; + man.enable = lib.mkDefault false; + nixos.enable = lib.mkDefault false; + }; + + programs.command-not-found.enable = lib.mkDefault false; + + xdg = { + autostart.enable = lib.mkDefault false; + icons.enable = lib.mkDefault false; + mime.enable = lib.mkDefault false; + sounds.enable = lib.mkDefault false; + }; + }; +} diff --git a/modules/nix.nix b/modules/nix.nix new file mode 100644 index 0000000..291e64f --- /dev/null +++ b/modules/nix.nix @@ -0,0 +1,18 @@ +{ lib, config, ... }: +let cfg = config.nodeconfig; in { + options.nix.auto-gc = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Enable Automatic Garbage collection of the Nix store"; + }; + + config = lib.mkIf cfg.nix.auto-gc { + nix.gc = { + automatic = true; + dates = "Fri *-*-* 00:00:00"; + options = "--delete-old"; + randomizedDelaySec = "1h"; + }; + }; +}