dotfiles/nixos/modules/ollama.nix

41 lines
980 B
Nix
Raw Normal View History

2024-10-06 15:25:05 -05:00
{flake, ...}: let
2024-10-19 18:22:29 -05:00
inherit (flake.config.service.instance) ollama web;
service = ollama;
localhost = web.localhost.address0;
2024-10-06 15:25:05 -05:00
in {
services = {
ollama = {
acceleration = false;
enable = true;
2024-10-19 18:22:29 -05:00
group = service.name;
2024-10-06 15:25:05 -05:00
host = "http://${localhost}";
2024-10-19 18:22:29 -05:00
models = service.paths.path1;
user = service.name;
2024-10-06 15:25:05 -05:00
};
open-webui = {
enable = true;
host = localhost;
2024-10-19 18:22:29 -05:00
port = service.ports.port0;
2024-10-06 15:25:05 -05:00
environment = {
ENABLE_OLLAMA_API = "True";
ANONYMIZED_TELEMETRY = "False";
DO_NOT_TRACK = "True";
SCARF_NO_ANALYTICS = "True";
2024-10-19 18:22:29 -05:00
OLLAMA_BASE_URL = "http://${localhost}:${toString service.ports.port1}";
2024-10-06 15:25:05 -05:00
WEBUI_AUTH = "True";
};
};
};
2024-10-19 18:22:29 -05:00
systemd.tmpfiles.rules = ["Z ${service.paths.path1} 0755 ${service.name} ${service.name} -"];
2024-10-06 15:25:05 -05:00
networking = {
firewall = {
allowedTCPPorts = [
2024-10-19 18:22:29 -05:00
service.ports.port0
service.ports.port1
2024-10-06 15:25:05 -05:00
];
};
};
}