Add ollama service/virtualization block

This commit is contained in:
Chris Thompson 2024-12-14 18:45:21 -05:00
parent 66d7fdf559
commit 04cee1bdd8

View file

@ -275,7 +275,56 @@
hardware.graphics.extraPackages32 = [ hardware.graphics.extraPackages32 = [
pkgs.driversi686Linux.amdvlk pkgs.driversi686Linux.amdvlk
]; ];
services.ollama = {
enable = true;
acceleration = "rocm";
environmentVariables = {
HCC_AMDGPU_TARGET = "gfx1031"; # used to be necessary, but doesn't seem to anymore
};
rocmOverrideGfx = "10.3.1";
};
system.activationScripts = {
script.text = ''
install -d -m 755 /home/wolcen/.open-webui -o root -g root
'';
};
virtualisation = {
# Add docker!
docker.enable = true;
podman.enable = false;
docker.storageDriver = "btrfs"; # Only when using BTRFS! (wolcen approved!)
oci-containers = {
backend = "docker";
containers = {
open-webui = {
image = "ghcr.io/open-webui/open-webui:main";
environment = {
"TZ" = "America/New York";
"OLLAMA_API_BASE_URL" = "http://127.0.0.1:11434/api";
"OLLAMA_BASE_URL" = "http://127.0.0.1:11434";
"WEBUI_URL" = "http://127.0.0.1:8080/";
};
volumes = [
"/home/wolcen/.openweb-ui:/app/backend/data"
];
ports = [
"127.0.0.1:3000:8080" # Ensures we listen only on localhost
];
extraOptions = [
"--pull=always" # Pull if the image on the registry is newer
"--name=open-webui"
"--hostname=open-webui"
"--network=host"
"--add-host=host.containers.internal:host-gateway"
];
};
};
};
};
# Force radv # Force radv
environment.variables.AMD_VULKAN_ICD = "RADV"; environment.variables.AMD_VULKAN_ICD = "RADV";
# Or # Or