diff options
-rw-r--r-- | hosts/frigg/modules/default.nix | 2 | ||||
-rw-r--r-- | modules/services/llm/default.nix | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/hosts/frigg/modules/default.nix b/hosts/frigg/modules/default.nix index 68ac7f3..a4cc63a 100644 --- a/hosts/frigg/modules/default.nix +++ b/hosts/frigg/modules/default.nix @@ -25,7 +25,7 @@ services.llm = { enable = true; port = 11111; - networkRange = "10.44.0.0/16"; + subnet = "10.44.0.0/16"; nvidiaGpu = true; models = [ "mistral" 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. |