organise all options into modules

This commit is contained in:
atagen 2024-05-08 15:05:43 +10:00
parent c7c6606d14
commit 3192b6ca09
43 changed files with 518 additions and 423 deletions

View file

@ -9,51 +9,14 @@
imports = [
./home.nix
./util/local-webapp.nix
./programs/stable-diffusion.nix
./programs/ollama.nix
];
home = {
username = "bolt";
homeDirectory = "/home/bolt";
packages = with pkgs; [
nicotine-plus
];
};
localWebApps = {
stable-diffusion = {
name = "Stable Diffusion (ComfyUI)";
genericName = "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 = "Ollama (OpenWebUI)";
genericName = "Ollama";
icon = ./icons/openwebui.png;
id = 6;
port = 3021;
service = let
docker = lib.getExe pkgs.docker;
in {
Type = "exec";
ExecStartPre = "${pkgs.writeShellScript "openwebui-check" ''
set -euo pipefail
echo Checking for container existence..
if [[ $(${docker} inspect openwebui &> /dev/null; printf $?) -ne 0 ]]; then
echo Not found. Creating OpenWebUI/Ollama container..
${docker} create -e PORT=${builtins.toString port} --network host --gpus all -v ollama:/root/.ollama -v open-webui:/app/backend/data --name openwebui --restart always ghcr.io/open-webui/open-webui:ollama
fi
echo Check complete.
''}";
ExecStart = "${docker} start -a openwebui";
ExecStop = "${docker} stop openwebui";
};
};
};
services.flatpak.packages = ["org.nicotine_plus.Nicotine"];
}