From e12c880352775428bdaf890193cbbf6720a927f9 Mon Sep 17 00:00:00 2001 From: tdback Date: Mon, 27 Jan 2025 21:58:58 -0500 Subject: llm: change `networkRange` option to `subnet` --- modules/services/llm/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'modules/services/llm') diff --git a/modules/services/llm/default.nix b/modules/services/llm/default.nix index 0c97720..e2e08a9 100644 --- a/modules/services/llm/default.nix +++ b/modules/services/llm/default.nix @@ -15,10 +15,10 @@ in type = types.int; description = "Which port the Open-WebUI server listens to."; }; - networkRange = mkOption { + subnet = mkOption { default = null; type = types.str; - description = "The network range allowed to acccess Open-WebUI and the ollama API"; + description = "The network subnet allowed to acccess Open-WebUI and the ollama API"; }; nvidiaGpu = mkOption { default = false; @@ -41,7 +41,7 @@ in services.open-webui = { enable = true; - host = if cfg.networkRange == null then "127.0.0.1" else "0.0.0.0"; + host = if cfg.subnet == null then "127.0.0.1" else "0.0.0.0"; port = cfg.port; }; @@ -53,9 +53,9 @@ in api = builtins.toString ollama.port; web = builtins.toString open-webui.port; in - mkIf (cfg.networkRange != null) '' - iptables -A nixos-fw -p tcp --source ${cfg.networkRange} --dport ${api}:${api} -j nixos-fw-accept - iptables -A nixos-fw -p tcp --source ${cfg.networkRange} --dport ${web}:${web} -j nixos-fw-accept + mkIf (cfg.subnet != null) '' + iptables -A nixos-fw -p tcp --source ${cfg.subnet} --dport ${api}:${api} -j nixos-fw-accept + iptables -A nixos-fw -p tcp --source ${cfg.subnet} --dport ${web}:${web} -j nixos-fw-accept ''; # Enable the proprietary NVIDIA drivers in a headless fashion. -- cgit v1.2.3