From 1d5ca050fdc50321b2c4691b2d74f54f2d966e9a Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Fri, 5 Jul 2024 02:03:52 +0530 Subject: [PATCH] flake: init modules --- flake.nix | 1 + modules/default.nix | 6 ++++++ modules/general.nix | 28 ++++++++++++++++++++++++++++ modules/nix.nix | 18 ++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 modules/default.nix create mode 100644 modules/general.nix create mode 100644 modules/nix.nix 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"; + }; + }; +}