about summary refs log tree commit diff
path: root/configurations/eonwe/ollama.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--configurations/eonwe/ollama.nix97
1 files changed, 97 insertions, 0 deletions
diff --git a/configurations/eonwe/ollama.nix b/configurations/eonwe/ollama.nix
new file mode 100644
index 0000000..806885b
--- /dev/null
+++ b/configurations/eonwe/ollama.nix
@@ -0,0 +1,97 @@
+{
+  config,
+  lib,
+  ...
+}:
+{
+  ark.directories = [
+    config.services.ollama.home
+  ];
+
+  hm.programs.firefox.profiles.default.bookmarks = [
+    {
+      name = "Bookmarks Toolbar";
+      toolbar = true;
+      bookmarks = [
+        {
+          name = "Ollama";
+          url = "http://eonwe.shire.net:11435";
+        }
+        {
+          name = "Open WebUI";
+          url = "http://eonwe.shire.net:11436";
+        }
+      ];
+    }
+  ];
+
+  services = {
+    ollama = {
+      enable = true;
+
+      host = "0.0.0.0";
+      port = 11434;
+
+      user = "ollama";
+      group = "ollama";
+
+      acceleration = "rocm";
+      rocmOverrideGfx = "11.0.0";
+
+      environmentVariables.OLLAMA_ORIGINS = lib.concatStringsSep "," [
+        "http://eonwe.shire.net:11434"
+        "http://eonwe.shire.net: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 = true;
+
+      host = "0.0.0.0";
+      port = 11436;
+
+      environment = {
+        ANONYMIZED_TELEMETRY = "False";
+        DO_NOT_TRACK = "True";
+        ENABLE_SIGNUP = "False";
+        OLLAMA_BASE_URL = "http://eonwe.shire.net:11434";
+        SCARF_NO_ANALYTICS = "True";
+        WEBUI_AUTH = "False";
+        WEBUI_URL = "http://eonwe.shire.net:11436";
+      };
+
+      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;
+  };
+
+  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