add (host options): add basic host options

This commit is contained in:
Kirill Samoylenkov 2025-09-27 15:20:18 +05:00
parent 83abf471a4
commit 0d99d55ef5
7 changed files with 242 additions and 0 deletions

43
options/host/locale.nix Normal file
View file

@ -0,0 +1,43 @@
{
lib,
pkgs,
config,
...
}:
let
cfg = config.host.locale;
in
{
options = {
host.locale = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Basic locale settings.";
};
timeZone = lib.mkOption {
type = lib.types.str;
default = "America/New_York";
description = "Time Zone Locale.";
};
};
};
config = lib.mkIf cfg.enable {
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
time.timeZone = cfg.timeZone;
};
}

View file

@ -0,0 +1,25 @@
{ lib, config, ... }:
let
cfg = config.host.xserver;
in
{
options = {
host.xserver = {
enable = lib.mkOption {
types = lib.types.bool;
default = true;
description = "Xserver configurations for host.";
};
};
};
config = lib.mkIf cfg.enable {
services.xserver = {
enable = true;
xkb = {
layout = "us";
variant = "";
};
};
};
}

44
options/host/nix.nix Normal file
View file

@ -0,0 +1,44 @@
{
lib,
pkgs,
config,
...
}:
let
cfg = config.host.nix;
in
{
options = {
host.nix = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Nix settings for host.";
};
optimization.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Nix store optimization.";
};
};
};
config = lib.mkIf cfg.enable {
nix = {
package = pkgs.nix;
settings = {
warn-dirty = false;
experimental-features = [
"flakes"
"nix-command"
"pipe-operators"
];
};
optimise = lib.mkIf cfg.optimization.enable {
automatic = true;
};
};
};
}

27
options/host/polkit.nix Normal file
View file

@ -0,0 +1,27 @@
{
lib,
pkgs,
config,
...
}:
let
cfg = config.host.polkit;
in
{
options = {
host.polkit = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Polkit configurations for host.";
};
};
};
config = lib.mkIf cfg.enable {
security.polkit = {
enable = true;
package = pkgs.polkit;
};
};
}

20
options/host/version.nix Normal file
View file

@ -0,0 +1,20 @@
{
lib,
pkgs,
config,
...
}:
let
cfg = config.host.version;
in
{
options = {
host.version = lib.mkOption {
type = lib.types.str;
default = "25.05";
description = "System version.";
};
};
config.system.stateVersion = cfg;
}

View file

@ -0,0 +1,58 @@
{
lib,
pkgs,
config,
...
}:
let
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.";
};
powerProfiles.enable = lib.mkOption {
type = lib.types.bool;
default = !config.device.battery.enable;
description = "Power Profiles Daemon configurations for host.";
};
};
};
config = mkIf cfg.enable {
services.desktopManager.plasma6.enable = true;
environment.plasma6.excludePackages = with pkgs.kdePackages; [
kate
elisa
konsole
kdepim-runtime
plasma-browser-integration
];
environment.systemPackages = [
pkgs.wl-clipboard
pkgs.wayland-utils
]
++ lib.optional cfg.sddm.enable [
pkgs.kdePackages.sddm-kcm
];
services.power-profiles-daemon.enable = cfg.powerProfiles.enable;
services.displayManager.sddm = lib.mkIf cfg.sddm.enable {
enable = true;
wayland.enable = true;
};
};
}

25
options/host/xserver.nix Normal file
View file

@ -0,0 +1,25 @@
{ lib, config, ... }:
let
cfg = config.host.xserver;
in
{
options = {
host.xserver = {
enable = lib.mkOption {
types = lib.types.bool;
default = true;
description = "Xserver configurations for host.";
};
};
};
config = lib.mkIf cfg.enable {
services.xserver = {
enable = true;
xkb = {
layout = "us";
variant = "";
};
};
};
}