clear (refactor options): refactor options

This commit is contained in:
Kirill Samoylenkov 2025-10-01 20:20:47 +05:00
parent 00ea2b0c36
commit bfce36ce73
22 changed files with 340 additions and 463 deletions

View file

@ -5,26 +5,23 @@
...
}:
let
inherit (lib) mkOption mkEnableOption mkIf;
inherit (lib.types) str;
cfg = config.host.locale;
in
{
options = {
host.locale = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Basic locale settings.";
};
options.host.locale = {
enable = mkEnableOption "Basic locale settings.";
timeZone = lib.mkOption {
type = lib.types.str;
default = "America/New_York";
description = "Time Zone Locale.";
};
timeZone = mkOption {
type = str;
default = "America/New_York";
description = "Time Zone Locale.";
};
};
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";

View file

@ -5,25 +5,17 @@
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.host.nix;
in
{
options = {
host.nix = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Nix settings for host.";
};
optimization.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Nix store optimization.";
};
};
options.host.nix = {
enable = mkEnableOption "Nix settings strfor host.";
optimization.enable = mkEnableOption "Nix store optimization.";
};
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
nix = {
package = pkgs.nix;
@ -36,7 +28,7 @@ in
];
};
optimise = lib.mkIf cfg.optimization.enable {
optimise = mkIf cfg.optimization.enable {
automatic = true;
};
};

View file

@ -5,20 +5,16 @@
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.host.polkit;
in
{
options = {
host.polkit = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Polkit configurations for host.";
};
};
options.host.polkit = {
enable = mkEnableOption "Polkit configurations for host.";
};
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
security.polkit = {
enable = true;
package = pkgs.polkit;

View file

@ -5,15 +5,16 @@
...
}:
let
inherit (lib) mkOption;
inherit (lib.types) str;
cfg = config.host.version;
in
{
options = {
host.version = lib.mkOption {
type = lib.types.str;
default = "25.05";
description = "System version.";
};
options.host.version = mkOption {
type = str;
default = "25.05";
description = "System version.";
};
config.system.stateVersion = cfg;

View file

@ -5,31 +5,24 @@
...
}:
let
inherit (lib) mkOption mkEnableOption mkIf;
inherit (lib.types) bool;
cfg = config.host.window_managers.kde;
in
{
options = {
host.window_managers.kde = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "KDE Clear configurations for host.";
};
sddm.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "SDDM configurations for host.";
};
options.host.window_managers.kde = {
enable = mkEnableOption "KDE Clear configurations for host.";
sddm.enable = mkEnableOption "SDDM configurations for host.";
powerProfiles.enable = lib.mkOption {
type = lib.types.bool;
default = !config.device.laptop.battery.enable;
description = "Power Profiles Daemon configurations for host.";
};
powerProfiles.enable = mkOption {
type = bool;
default = !config.device.laptop.battery.enable;
description = "Power Profiles Daemon configurations for host.";
};
};
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
services.desktopManager.plasma6.enable = true;
environment.plasma6.excludePackages = with pkgs.kdePackages; [
@ -48,7 +41,7 @@ in
services.power-profiles-daemon.enable = cfg.powerProfiles.enable;
services.displayManager.sddm = lib.mkIf cfg.sddm.enable {
services.displayManager.sddm = mkIf cfg.sddm.enable {
enable = true;
wayland.enable = true;
};

View file

@ -1,19 +1,15 @@
{ lib, config, ... }:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.host.xserver;
in
{
options = {
host.xserver = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Xserver configurations for host.";
};
};
options.host.xserver = {
enable = mkEnableOption "Xserver configurations for host.";
};
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
services.xserver = {
enable = true;
xkb = {