From 5d22ee3c019b8042c0d862097c632f2cc83c63c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= <dev@felschr.com>
Date: Thu, 13 Feb 2025 23:21:21 +0100
Subject: [PATCH] feat(open-webui): update configuration

---
 hosts/home-pc.nix       |  1 +
 services/open-webui.nix | 29 ++++++++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/hosts/home-pc.nix b/hosts/home-pc.nix
index de48f35..2458661 100644
--- a/hosts/home-pc.nix
+++ b/hosts/home-pc.nix
@@ -19,6 +19,7 @@
     ../services/samba/home-pc.nix
     ../services/restic/home-pc.nix
     ../services/pcscd.nix
+    ../services/open-webui.nix
   ];
 
   nixpkgs.config.allowUnfree = true;
diff --git a/services/open-webui.nix b/services/open-webui.nix
index eb659c7..67794c8 100644
--- a/services/open-webui.nix
+++ b/services/open-webui.nix
@@ -1,9 +1,36 @@
-{ pkgs, ... }:
+{
+  config,
+  inputs,
+  pkgs,
+  ...
+}:
 
 {
+  disabledModules = [
+    "services/misc/ollama.nix"
+    "services/misc/open-webui.nix"
+  ];
+
+  imports = [
+    "${inputs.nixpkgs-unstable}/nixos/modules/services/misc/ollama.nix"
+    "${inputs.nixpkgs-unstable}/nixos/modules/services/misc/open-webui.nix"
+  ];
+
+  services.ollama = {
+    enable = true;
+    package = pkgs.unstable.ollama;
+    acceleration = "rocm";
+    rocmOverrideGfx = "10.3.1";
+  };
+
   services.open-webui = {
     enable = true;
     package = pkgs.unstable.open-webui;
+    host = "0.0.0.0";
     port = 11111;
+    environment = {
+      WEBUI_AUTH = "False";
+      OLLAMA_API_BASE_URL = "http://127.0.0.1:${toString config.services.ollama.port}";
+    };
   };
 }