From ce8efa33711d167e376603d06b8e0bca9ce9fe60 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Fri, 12 May 2023 12:32:29 +0200 Subject: [PATCH] architect: Added architect.networks option attribute set --- hosts/architect/options.nix | 69 ++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/hosts/architect/options.nix b/hosts/architect/options.nix index 5f530b9..fd0b5ab 100644 --- a/hosts/architect/options.nix +++ b/hosts/architect/options.nix @@ -3,23 +3,60 @@ with lib; { - options.architect.firewall = { - openTCP = mkOption { - type = types.listOf types.int; - default = [ ]; + options.architect = { + firewall = { + openTCP = mkOption { + type = types.listOf types.int; + default = [ ]; + }; + openUDP = mkOption { + type = types.listOf types.int; + default = [ ]; + }; + openTCPVPN = mkOption { + type = types.listOf types.int; + default = [ ]; + }; + openUDPVPN = mkOption { + type = types.listOf types.int; + default = [ ]; + }; }; - openUDP = mkOption { - type = types.listOf types.int; - default = [ ]; - }; - openTCPVPN = mkOption { - type = types.listOf types.int; - default = [ ]; - }; - openUDPVPN = mkOption { - type = types.listOf types.int; - default = [ ]; + + networks = mkOption { + type = types.attrsOf (types.submodule { + options = { + interface = mkOption { + type = types.str; + description = "The network interface name."; + }; + + net = mkOption { + type = types.str; + description = "The network address in CIDR format."; + }; + + devices = mkOption { + type = types.attrsOf (types.submodule { + options = { + address = mkOption { + type = types.str; + description = "The IP address of the device."; + }; + + hostname = mkOption { + type = types.str; + description = "The hostname of the device."; + }; + }; + }); + default = { }; + description = "An attribute set of devices with their configurations."; + }; + }; + }); + default = { }; + description = "An attribute set of networks with their configurations."; }; }; - }