some refactoring and modularizing locale

This commit is contained in:
cnst
2024-10-23 20:11:01 +02:00
parent 86046c6414
commit b7784f9b15
58 changed files with 256 additions and 165 deletions

View File

@@ -0,0 +1,62 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption types;
cfg = config.nixos.hardware.network;
in {
options = {
nixos = {
hardware = {
network = {
enable = mkEnableOption "Enable the custom networking module";
hostName = mkOption {
type = types.str;
default = "default-hostname";
description = "Hostname for the nixos.";
};
interfaces = mkOption {
type = types.attrsOf (types.submodule {
options = {
allowedTCPPorts = mkOption {
type = types.listOf types.int;
default = [];
description = "List of allowed TCP ports for this interface.";
};
};
});
default = {};
description = "Network interface configurations.";
};
nm-applet = {
enable = mkEnableOption "Enables the nm-applet service.";
indicator = mkOption {
type = types.bool;
default = false;
description = "Enables the nm-applet indicator.";
};
};
};
};
};
};
config = mkIf cfg.enable {
networking = {
networkmanager.enable = true;
inherit (cfg) hostName;
nftables.enable = true;
firewall = {
enable = true;
inherit (cfg) interfaces;
};
};
programs.nm-applet = {
enable = cfg.nm-applet.enable;
indicator = cfg.nm-applet.indicator;
};
};
}