diff options
| author | Natasha Moongrave <natasha@256phi.eu> | 2026-06-01 19:42:57 +0200 |
|---|---|---|
| committer | Natasha Moongrave <natasha@256phi.eu> | 2026-06-01 19:42:57 +0200 |
| commit | 7cf40a9e058c0d602fc5e21f0447a04ef78144e7 (patch) | |
| tree | 51cdae0d4baa9b09df2ee4afd3a5e2a2b2444f2e /hosts | |
| parent | b4b43c72ec3f82db90a872dd1d1de2c9721fcb37 (diff) | |
Rewrote ai.nix to use native nixos containerisation
Diffstat (limited to 'hosts')
| -rw-r--r-- | hosts/herra/ai.nix | 81 |
1 files changed, 45 insertions, 36 deletions
diff --git a/hosts/herra/ai.nix b/hosts/herra/ai.nix index 355d31f..c261506 100644 --- a/hosts/herra/ai.nix +++ b/hosts/herra/ai.nix @@ -1,20 +1,54 @@ {pkgs, ...}: { + # ---------------------------- + # Docker runtime (for UI only) + # ---------------------------- virtualisation.docker.enable = true; + virtualisation.docker.autoPrune.enable = true; - environment.systemPackages = with pkgs; [ - arion - ]; - + # ---------------------------- + # Ollama (native, stable core) + # ---------------------------- services.ollama = { enable = true; - - host = "0.0.0.0"; + host = "127.0.0.1"; port = 11434; + }; + + # ---------------------------- + # Persistent storage + # ---------------------------- + systemd.tmpfiles.rules = [ + "d /var/lib/odysseus 0755 root root -" + ]; + + # ---------------------------- + # Odysseus UI container (minimal) + # ---------------------------- + virtualisation.oci-containers.containers.odysseus = { + image = "ghcr.io/pewdiepie-archdaemon/odysseus:latest"; + + ports = [ + "7000:7000" + ]; + + volumes = [ + "/var/lib/odysseus:/app/data" + ]; + + environment = { + LLM_HOST = "http://host.docker.internal:11434"; + AUTH_ENABLED = "true"; + }; - # probably won't work reliably on Polaris - # acceleration = "rocm"; + extraOptions = [ + "--add-host=host.docker.internal:host-gateway" + "--restart=unless-stopped" + ]; }; + # ---------------------------- + # Optional: reverse proxy (clean URL) + # ---------------------------- services.nginx = { enable = true; @@ -26,32 +60,7 @@ }; }; - environment.etc."arion/arion-compose.nix".source = - ./arion-compose.nix; - - environment.etc."arion/arion-pkgs.nix".text = '' - { pkgs ? import <nixpkgs> {} }: - { - } - ''; - - systemd.services.odysseus = { - wantedBy = ["multi-user.target"]; - - after = [ - "docker.service" - "ollama.service" - ]; - - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - - WorkingDirectory = "/etc/arion"; - - ExecStart = "${pkgs.arion}/bin/arion up -d"; - - ExecStop = "${pkgs.arion}/bin/arion down"; - }; - }; + networking.firewall.allowedTCPPorts = [ + 7000 + ]; } |
