aboutsummaryrefslogtreecommitdiff
path: root/modules/server/ollama/default.nix
blob: 3b99daf2a1d72f3e5e2585beed244bbd6d3119ad (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{ config, pkgs, lib, ... }:
{
  services = {
    ollama = {
      enable = true;
      loadModels = [
        "qwen3:14b"
        "gemma3:12b"
        "gpt-oss:20b"
        "deepseek-r1:14b"
        "phi4-reasoning:14b"
      ];

      acceleration = "rocm";
      environmentVariables = {
        HCC_AMDGPU_TARGET = "gfx1031";
      };
      rocmOverrideGfx = "10.3.0";
    };

    open-webui = {
      enable = true;
      port = 3030;
      environment = {
        ANONYMIZED_TELEMETRY = "False";
        DO_NOT_TRACK = "True";
        SCARF_NO_ANALYTICS = "True";
        WEBUI_AUTH = "False";
        OLLAMA_API_BASE_URL = "http://localhost:11434";

        #dir stuff
    		STATIC_DIR = "${config.services.open-webui.stateDir}/static";
    		DATA_DIR = "${config.services.open-webui.stateDir}/data";
    		HF_HOME = "${config.services.open-webui.stateDir}/hf_home";
    		SENTENCE_TRANSFORMERS_HOME = "${config.services.open-webui.stateDir}/transformers_home";
      };
    };

    xserver.videoDrivers = [ "amdgpu" ];

    nginx.virtualHosts = {
      "chat.internal" = {
        locations."/" = {
          proxyPass = "http://127.0.0.1:3030";
          proxyWebsockets = true;
        };
      };

      "ollama.internal" = {
        locations."/" = {
          proxyPass = "http://127.0.0.1:11434";
          proxyWebsockets = true;
        };
      };
    };
  };

  nixpkgs.config = {
    allowUnfree = lib.mkForce true;
    rocmSupport = lib.mkForce true;
    rocmTargets = [ "gfx1031" ];
  };

  environment.systemPackages = with pkgs; [
    rocmPackages.rocminfo
    rocmPackages.rocm-smi
    rocmPackages.hipcc
  ];
}
Directive (EU) 2019/790, Article 4(3); all rights regarding Text and Data Mining (TDM) are reserved.