meta: Make system module customizable

This commit is contained in:
Donovan Glover 2024-04-04 09:41:32 -04:00
parent e1e1243618
commit 7ef220be22
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -1,59 +1,81 @@
{ pkgs, ... }: { pkgs, lib, config, ... }:
let let
inherit (lib) mkOption;
inherit (lib.types) str listOf;
inherit (pkgs.nixVersions) nix_2_19; inherit (pkgs.nixVersions) nix_2_19;
# TODO: Make these variables options cfg = config.modules.system;
timeZone = "America/New_York";
defaultLocale = "ja_JP.UTF-8";
supportedLocales = [ "ja_JP.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" "fr_FR.UTF-8/UTF-8" ];
stateVersion = "22.11";
in in
{ {
boot = { options.modules.system = {
tmp.cleanOnBoot = true; timeZone = mkOption {
type = str;
default = "America/New_York";
};
loader = { defaultLocale = mkOption {
systemd-boot = { type = str;
enable = true; default = "ja_JP.UTF-8";
editor = false; };
configurationLimit = 10;
supportedLocales = mkOption {
type = listOf str;
default = [ "ja_JP.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" "fr_FR.UTF-8/UTF-8" ];
};
stateVersion = mkOption {
type = str;
default = "22.11";
};
};
config = {
boot = {
tmp.cleanOnBoot = true;
loader = {
systemd-boot = {
enable = true;
editor = false;
configurationLimit = 10;
};
timeout = 0;
efi.canTouchEfiVariables = true;
}; };
timeout = 0;
efi.canTouchEfiVariables = true;
}; };
};
systemd = { systemd = {
extraConfig = "DefaultTimeoutStopSec=10s"; extraConfig = "DefaultTimeoutStopSec=10s";
services.NetworkManager-wait-online.enable = false; services.NetworkManager-wait-online.enable = false;
};
nix = {
package = nix_2_19;
settings = {
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
auto-optimise-store = true;
warn-dirty = false;
}; };
};
zramSwap = { nix = {
enable = true; package = nix_2_19;
memoryPercent = 100;
};
time = { settings = {
inherit timeZone; experimental-features = [ "nix-command" "flakes" "repl-flake" ];
}; auto-optimise-store = true;
warn-dirty = false;
};
};
i18n = { zramSwap = {
inherit defaultLocale supportedLocales; enable = true;
}; memoryPercent = 100;
};
system = { time = {
inherit stateVersion; inherit (cfg) timeZone;
};
i18n = {
inherit (cfg) defaultLocale supportedLocales;
};
system = {
inherit (cfg) stateVersion;
};
}; };
} }