about summary refs log tree commit diff
path: root/configurations/eonwe/ollama.nix
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2024-12-17 02:04:27 +0300
committerazahi <azat@bahawi.net>2024-12-17 02:04:27 +0300
commit1ae038a0a86348074b422ea87c03836b0962af67 (patch)
treeae56c73c01b4777e3e24a22c2d67943706997cf0 /configurations/eonwe/ollama.nix
parent2024-12-02 (diff)
2024-12-17 HEAD master
Diffstat (limited to 'configurations/eonwe/ollama.nix')
-rw-r--r--configurations/eonwe/ollama.nix67
1 files changed, 40 insertions, 27 deletions
diff --git a/configurations/eonwe/ollama.nix b/configurations/eonwe/ollama.nix
index 69fa9fd..806885b 100644
--- a/configurations/eonwe/ollama.nix
+++ b/configurations/eonwe/ollama.nix
@@ -3,7 +3,6 @@
   lib,
   ...
 }:
-
 {
   ark.directories = [
     config.services.ollama.home
@@ -16,7 +15,11 @@
       bookmarks = [
         {
           name = "Ollama";
-          url = "http://127.0.0.1:11435";
+          url = "http://eonwe.shire.net:11435";
+        }
+        {
+          name = "Open WebUI";
+          url = "http://eonwe.shire.net:11436";
         }
       ];
     }
@@ -24,7 +27,7 @@
 
   services = {
     ollama = {
-      enable = false;
+      enable = true;
 
       host = "0.0.0.0";
       port = 11434;
@@ -33,52 +36,62 @@
       group = "ollama";
 
       acceleration = "rocm";
-      rocmOverrideGfx = "10.3.0";
+      rocmOverrideGfx = "11.0.0";
 
       environmentVariables.OLLAMA_ORIGINS = lib.concatStringsSep "," [
-        "http://127.0.0.1:11435"
+        "http://eonwe.shire.net:11434"
         "http://eonwe.shire.net:11435"
-        "http://eonwe:11435"
-        "http://localhost:11435"
+        "http://eonwe.shire.net:11436"
       ];
 
       openFirewall = true;
     };
 
+    nextjs-ollama-llm-ui = {
+      enable = true;
+
+      hostname = "0.0.0.0";
+      port = 11435;
+
+      ollamaUrl = "http://eonwe.shire.net:11434";
+    };
+
     open-webui = {
-      enable = false;
+      enable = true;
+
+      host = "0.0.0.0";
       port = 11436;
+
       environment = {
         ANONYMIZED_TELEMETRY = "False";
         DO_NOT_TRACK = "True";
         ENABLE_SIGNUP = "False";
-        OLLAMA_BASE_URL = "http://127.0.0.1:11434";
+        OLLAMA_BASE_URL = "http://eonwe.shire.net:11434";
         SCARF_NO_ANALYTICS = "True";
         WEBUI_AUTH = "False";
         WEBUI_URL = "http://eonwe.shire.net:11436";
       };
-    };
 
-    nextjs-ollama-llm-ui = {
-      enable = false;
-
-      hostname = "0.0.0.0";
-      port = 11435;
-
-      ollamaUrl = "http://127.0.0.1:11434";
+      openFirewall = true;
     };
   };
 
-  systemd.services = {
-    ollama = {
-      serviceConfig = {
-        StateDirectory = lib.mkForce config.services.ollama.home;
-        DynamicUser = lib.mkForce false;
-        User = config.services.ollama.user;
-        Group = config.services.ollama.group;
-      };
-    };
+  systemd.services.ollama.serviceConfig = {
+    StateDirectory = lib.mkForce config.services.ollama.home;
+    DynamicUser = lib.mkForce false;
+    User = config.services.ollama.user;
+    Group = config.services.ollama.group;
+  };
 
-    nextjs-ollama-llm-ui.serviceConfig.CacheDirectory = "nextjs-ollama-llm-ui";
+  users = {
+    users.ollama = {
+      isSystemUser = true;
+      group = "ollama";
+      inherit (config.services.ollama) home;
+      uid = 241; # Reuses a removed ID from Nixpkgs.
+    };
+    groups.ollama.gid = 241;
   };
+
+  my.extraGroups = [ "ollama" ];
 }

Consider giving Nix/NixOS a try! <3