diff --git a/modules/networking/options.nix b/modules/networking/options.nix new file mode 100644 index 0000000..e9249b1 --- /dev/null +++ b/modules/networking/options.nix @@ -0,0 +1,65 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.homelab.networking; +in +{ + options.homelab.networking = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Enable homelab networking support."; + }; + + # wireguard + wireguard = { + enable = lib.mkEnableOption "Wireguard support"; + + interfaces = lib.mkOption { + type = lib.types.attrsOf ( + lib.types.submodule { + options = { + enable = lib.mkEnableOption "Enable this WG interface"; + + address = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + }; + + privateKeyFile = lib.mkOption { + type = lib.types.str; + }; + + peers = lib.mkOption { + type = lib.types.listOf ( + lib.types.submodule { + options = { + publicKey = lib.mkOption { type = lib.types.str; }; + allowedIPs = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + }; + endpoint = lib.mkOption { + type = lib.types.str; + default = ""; + }; + persistentKeepalive = lib.mkOption { + type = lib.types.nullOr lib.types.int; + default = null; + }; + }; + } + ); + default = [ ]; + }; + }; + } + ); + }; + }; + }; +}