aboutsummaryrefslogtreecommitdiff
path: root/hosts/herra/ai.nix
blob: 9ca7632feb539b1f76b403fa453efdc7768eb033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{pkgs, ...}: {
  virtualisation.docker.enable = true;

  environment.systemPackages = with pkgs; [
    arion
  ];

  services.ollama = {
    enable = true;

    host = "0.0.0.0";
    port = 11434;

    # probably won't work reliably on Polaris
    # acceleration = "rocm";
  };

  services.nginx = {
    enable = true;

    virtualHosts."ai.local" = {
      locations."/" = {
        proxyPass = "http://127.0.0.1:7000";
        proxyWebsockets = true;
      };
    };
  };

  environment.etc."arion/arion-compose.nix".source =
    ./arion-compose.nix;

  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";
    };
  };
}