nixos/hosts/architect/llm.nix

86 lines
1.9 KiB
Nix
Raw Normal View History

{ config, pkgs, ... }:
2023-11-16 12:25:58 +00:00
let
domain = "pino.giugl.io";
2024-02-21 11:33:54 +00:00
backendPort = 8080;
frontendPort = 3030;
# llama-cpp = pkgs.unstablePkgs.llama-cpp.override { cudaSupport = true; };
# ollama = pkgs.unstablePkgs.ollama.override { inherit llama-cpp; };
2023-11-16 12:25:58 +00:00
in
{
2024-02-21 11:33:54 +00:00
# environment.systemPackages = [ ollama ];
2023-11-16 12:25:58 +00:00
architect.vhost.${domain} = {
dnsInterfaces = [ "tailscale" ];
locations."/" = {
host = "172.17.0.1";
port = frontendPort;
allowLan = true;
2024-02-21 11:33:54 +00:00
allowWAN = true;
# allow = [ config.architect.networks."tailscale".net ];
extraConfig = ''
proxy_read_timeout 600s;
'';
};
};
architect.vhost."ollama.giugl.io" = {
dnsInterfaces = [ "tailscale" ];
locations."/" = {
host = "172.17.0.1";
port = 11434;
allowLan = true;
allowWAN = true;
# allow = [ config.architect.networks."tailscale".net ];
extraConfig = ''
proxy_read_timeout 600s;
'';
2023-11-16 12:25:58 +00:00
};
};
virtualisation.oci-containers = {
containers = {
2024-02-21 11:33:54 +00:00
ollama-webui = {
image = "ghcr.io/open-webui/open-webui:main";
2023-11-16 12:25:58 +00:00
autoStart = true;
ports = [
"172.17.0.1:${toString frontendPort}:${toString backendPort}"
];
2024-02-21 11:33:54 +00:00
environment = {
PORT = "${toString backendPort}";
OLLAMA_API_BASE_URL = "http://172.17.0.1:11434/api";
};
extraOptions = [
"--pull=always"
];
volumes = [
"/var/lib/ollama-webui:/app/backend/data"
2023-11-16 12:25:58 +00:00
];
2024-02-21 11:33:54 +00:00
};
ollama = {
image = "ollama/ollama:latest";
autoStart = true;
2023-11-16 12:25:58 +00:00
extraOptions = [
"--pull=always"
2024-02-21 11:33:54 +00:00
"--gpus=all"
];
environment = {
OLLAMA_ORIGINS = "*";
};
volumes = [
"/ollama:/root/.ollama"
];
ports = [
"127.0.0.1:11434:11434"
"172.17.0.1:11434:11434"
2023-11-16 12:25:58 +00:00
];
};
};
};
}