refactor: extract 'firewall' and 'wol' modules

This commit is contained in:
2026-02-23 23:40:15 +01:00
parent 34ebb265e6
commit e7c6df1c9b
4 changed files with 88 additions and 23 deletions

33
modules/wol/default.nix Normal file
View File

@@ -0,0 +1,33 @@
{ lib, config, ... }:
let
inherit (lib) mkEnableOption mkOption types;
in
{
options.wol = {
enable = mkEnableOption "Wake-on-LAN configuration";
interfaces = mkOption {
type = types.attrsOf (
types.submodule {
options = {
macAddress = mkOption {
type = types.str;
example = "02:68:b3:29:da:98";
};
};
}
);
default = { };
};
};
config = lib.mkIf config.wol.enable {
networking.interfaces = lib.mapAttrs (_: iface: {
wakeOnLan.enable = true;
inherit (iface) macAddress;
}) config.wol.interfaces;
# firewall.allowedUDPPorts = [ 9 ];
};
}