From f47f761bb849036672705707576f09f88e122968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20M=C3=BChl?= Date: Fri, 19 Dec 2025 09:24:41 +0100 Subject: [PATCH] Add Ollama service with GPU support --- modules/nixos/services/default.nix | 1 + modules/nixos/services/ollama.nix | 36 +++++++++++++++++++++++++ overlays/unstable/default.nix | 3 +++ systems/x86_64-linux/cobalt/default.nix | 1 + 4 files changed, 41 insertions(+) create mode 100644 modules/nixos/services/ollama.nix diff --git a/modules/nixos/services/default.nix b/modules/nixos/services/default.nix index fc7421c..ad94807 100644 --- a/modules/nixos/services/default.nix +++ b/modules/nixos/services/default.nix @@ -2,5 +2,6 @@ imports = [ ./lnxlink.nix ./beszel.nix + ./ollama.nix ]; } diff --git a/modules/nixos/services/ollama.nix b/modules/nixos/services/ollama.nix new file mode 100644 index 0000000..fa28a4f --- /dev/null +++ b/modules/nixos/services/ollama.nix @@ -0,0 +1,36 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; let + cfg = config.services.elements.ollama; +in { + options.services.elements = { + ollama.enable = mkEnableOption "Enable Ollama"; + }; + + config = mkIf cfg.enable { + services = { + ollama = { + enable = true; + user = "ollama"; + host = "0.0.0.0"; + openFirewall = true; + acceleration = "rocm"; + }; + + qdrant = { + enable = true; + # settings = {}; + }; + + open-webui = { + enable = true; + host = "0.0.0.0"; + openFirewall = true; + }; + }; + }; +} diff --git a/overlays/unstable/default.nix b/overlays/unstable/default.nix index eec1969..3106845 100644 --- a/overlays/unstable/default.nix +++ b/overlays/unstable/default.nix @@ -9,6 +9,9 @@ orca-slicer claude-code lutris + ollama + # currently doesn't build on unstable + # open-webui ; bambu-studio = channels.unstable.bambu-studio.overrideAttrs (old: let diff --git a/systems/x86_64-linux/cobalt/default.nix b/systems/x86_64-linux/cobalt/default.nix index 4471b24..aecdd2c 100644 --- a/systems/x86_64-linux/cobalt/default.nix +++ b/systems/x86_64-linux/cobalt/default.nix @@ -102,6 +102,7 @@ with lib._elements; { lnxlink.enable = true; beszel-agent.enable = true; beszel-agent.key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMkUPOw28Cu2LMuzfmvjT/L2ToNHcADwGyGvSpJ4wH2T"; + elements.ollama.enable = true; pipewire = { enable = lib.mkForce true;