cosmic checkpoint
This commit is contained in:
parent
4031a614a8
commit
f623faa0ef
26 changed files with 1163 additions and 538 deletions
|
@ -2,34 +2,30 @@
|
|||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) getExe;
|
||||
inherit (builtins) toString;
|
||||
inherit (pkgs) writeShellScript;
|
||||
in {
|
||||
localWebApps = {
|
||||
openwebui = rec {
|
||||
name = "Ollama (OpenWebUI)";
|
||||
genericName = "Ollama";
|
||||
icon = ../icons/openwebui.png;
|
||||
id = 6;
|
||||
port = 3021;
|
||||
service = let
|
||||
docker = getExe pkgs.docker;
|
||||
in {
|
||||
Type = "exec";
|
||||
ExecStartPre = "${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=${toString port} --restart no --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.podman = {
|
||||
containers.ollama = {
|
||||
# serviceName = "ollama";
|
||||
image = "ollama/ollama:latest";
|
||||
# ports = ["11434:11434"];
|
||||
devices = ["nvidia.com/gpu=all"];
|
||||
autostart = false;
|
||||
networks = ["ollama"];
|
||||
extraOptions = [
|
||||
"--health-cmd"
|
||||
(lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/11434'")
|
||||
];
|
||||
};
|
||||
|
||||
networks.ollama = {
|
||||
Subnet = "192.168.10.0/24";
|
||||
Gateway = "192.168.10.1";
|
||||
};
|
||||
};
|
||||
|
||||
# containers.ollama = {
|
||||
# image = "ollama/ollama:latest";
|
||||
# # TODO: volume for models!
|
||||
# extraOptions = ["--network=host" "--device=nvidia.com/gpu=all"];
|
||||
# };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue