create localWebApps option

This commit is contained in:
atagen 2024-05-02 10:52:19 +10:00
parent a9e78be414
commit 9bc61077d5
5 changed files with 178 additions and 32 deletions

View file

@ -8,8 +8,7 @@
}: {
imports = [
./home.nix
./programs/stable-diffusion.nix
./programs/ollama.nix
./util/local-webapp.nix
];
home = {
@ -19,4 +18,32 @@
nicotine-plus
];
};
localWebApps = {
stable-diffusion = {
name = "ComfyUI (Stable Diffusion)";
icon = ./icons/comfyui.png;
id = 5;
port = 7860;
service = {
WorkingDirectory = "${config.home.homeDirectory}/code/etc/stable-diffusion-webui-docker";
ExecStart = "${lib.getExe pkgs.docker} compose --profile comfy up --build";
};
};
openwebui = rec {
name = "OpenWebUI (Ollama)";
icon = ./icons/openwebui.png;
id = 6;
port = 3021;
service = let
docker = lib.getExe pkgs.docker;
in {
Type = "exec";
ExecStartPre = "-${docker} create -e PORT=${builtins.toString port} --network host --gpus all -v ollama:/root/.ollama -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:ollama";
ExecStart = "${docker} start open-webui";
ExecStop = "${docker} stop open-webui";
};
};
};
}