feat(nixos): enable immich ml; bind localhost; add ollama env

This commit is contained in:
2026-01-18 21:35:15 +05:30
parent a97ff2c46d
commit 509a9b49ed
5 changed files with 24 additions and 10 deletions

View File

@@ -12,10 +12,25 @@
"Hasklug Nerd Font Mono" "Hasklug Nerd Font Mono"
]; ];
window-decoration = false; window-decoration = false;
title = ""; title = "ghostty";
command = "fish"; command = "fish";
background-opacity = 0.8; background-opacity = 0.8;
theme = "catppuccin-mocha"; theme = "catppuccin-mocha";
custom-shader = "~/.config/ghostty/shader.glsl";
# custom-shader = toString (pkgs.writeText "shader.glsl"
# /*
# glsl
# */
# ''
# void mainImage(out vec4 fragColor, in vec2 fragCoord) {
# vec2 uv = fragCoord / iResolution.xy;
# vec3 col = vec3(0.0);
# col.r = 0.1 + 0.9 * uv.x;
# col.g = 0.1 + 0.9 * uv.y;
# col.b = 0.2;
# fragColor = vec4(col, 1.0);
# }
# '');
}; };
systemd.enable = true; systemd.enable = true;
themes = { themes = {

View File

@@ -1,6 +1,6 @@
{device, ...}: { {device, ...}: {
imports = [ imports = [
# ./immich-machine-learning.nix ./immich-machine-learning.nix
]; ];
virtualisation = { virtualisation = {
docker.enable = true; docker.enable = true;

View File

@@ -2,12 +2,11 @@
port = 3003; port = 3003;
in { in {
virtualisation.oci-containers = { virtualisation.oci-containers = {
backend = "docker";
containers = { containers = {
immich-machine-learning = { immich-machine-learning = {
image = "ghcr.io/immich-app/immich-machine-learning:v${pkgs.immich.version}-cuda"; image = "ghcr.io/immich-app/immich-machine-learning:v${pkgs.immich.version}-cuda";
ports = [ ports = [
"0.0.0.0:${toString port}:3003" "127.0.0.1:${toString port}:3003"
]; ];
volumes = [ volumes = [
"model-cache:/cache" "model-cache:/cache"
@@ -20,7 +19,4 @@ in {
nvidia-docker nvidia-docker
nvidia-container-toolkit nvidia-container-toolkit
]; ];
# services.caddy.virtualHosts."ml.ryu.darksailor.dev".extraConfig = ''
# reverse_proxy localhost:${toString port}
# '';
} }

View File

@@ -25,6 +25,8 @@
OLLAMA_LLM_LIBRARY = "cuda"; OLLAMA_LLM_LIBRARY = "cuda";
LD_LIBRARY_PATH = "run/opengl-driver/lib"; LD_LIBRARY_PATH = "run/opengl-driver/lib";
HTTP_PROXY = "https://ollama.darksailor.dev"; HTTP_PROXY = "https://ollama.darksailor.dev";
OLLAMA_CONTEXT_LENGTH = "32000";
OLLAMA_KEEP_ALIVE = "30m";
}; };
package = pkgs.ollama-cuda; package = pkgs.ollama-cuda;
}; };

View File

@@ -3,8 +3,9 @@
secrets."llama/api_key".owner = config.services.caddy.user; secrets."llama/api_key".owner = config.services.caddy.user;
secrets."openai/api_key" = {}; secrets."openai/api_key" = {};
templates = { templates = {
"LLAMA_API_KEY.env".content = '' "ollama.env".content = ''
LLAMA_API_KEY=${config.sops.placeholder."llama/api_key"} LLAMA_API_KEY=${config.sops.placeholder."llama/api_key"}
OPENAI_API_KEYS=${config.sops.placeholder."openai/api_key"}
''; '';
}; };
}; };
@@ -21,7 +22,7 @@
WEBUI_URL = "https://chat.darksailor.dev"; WEBUI_URL = "https://chat.darksailor.dev";
OLLAMA_BASE_URL = "https://ollama.darksailor.dev"; OLLAMA_BASE_URL = "https://ollama.darksailor.dev";
}; };
environmentFile = "${config.sops.templates."LLAMA_API_KEY.env".path}"; environmentFile = "${config.sops.templates."ollama.env".path}";
}; };
caddy = { caddy = {
@@ -47,7 +48,7 @@
}; };
systemd.services.caddy = { systemd.services.caddy = {
serviceConfig = { serviceConfig = {
EnvironmentFile = config.sops.templates."LLAMA_API_KEY.env".path; EnvironmentFile = config.sops.templates."ollama.env".path;
}; };
}; };
} }