flake: init modules

This commit is contained in:
Adithya 2024-07-05 02:03:52 +05:30
parent 4c3c615010
commit 1d5ca050fd
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
4 changed files with 53 additions and 0 deletions

View file

@ -262,6 +262,7 @@
deploy-rs.packages.${pkgs.system}.default deploy-rs.packages.${pkgs.system}.default
]; ];
}; };
nixosModules.default = ./modules;
packages.getpaper = pkgs.callPackage ./extra-packages/scripts/getpaper { }; packages.getpaper = pkgs.callPackage ./extra-packages/scripts/getpaper { };
} }
); );

6
modules/default.nix Normal file
View file

@ -0,0 +1,6 @@
_: {
imports = [
./general.nix
./nix.nix
];
}

28
modules/general.nix Normal file
View file

@ -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;
};
};
}

18
modules/nix.nix Normal file
View file

@ -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";
};
};
}