big cleanup
This commit is contained in:
parent
533f88f4cd
commit
c7c6606d14
81 changed files with 0 additions and 8334 deletions
|
@ -1,78 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
config.programs.firefox.webapps = {
|
||||
"OpenWebUI" = {
|
||||
url = "http://127.0.0.1:3021";
|
||||
id = 6;
|
||||
extraSettings = config.programs.firefox.profiles.default.settings;
|
||||
name = "OpenWebUI Client";
|
||||
hidden = true;
|
||||
};
|
||||
};
|
||||
|
||||
config.systemd.user.services = {
|
||||
open-webui = {
|
||||
Unit.Description = "OpenWebUI";
|
||||
Service = let
|
||||
docker = lib.getExe pkgs.docker;
|
||||
in {
|
||||
Type = "exec";
|
||||
ExecStartPre = "-${docker} create -e PORT=3021 --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";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config.xdg.desktopEntries = {
|
||||
open-webui = {
|
||||
name = "Ollama OpenWebUI";
|
||||
type = "Application";
|
||||
icon = ../icons/openwebui.png;
|
||||
exec = "${let
|
||||
notify-send = "${lib.getExe' pkgs.libnotify "notify-send"} -a \"Ollama OpenWebUI\"";
|
||||
systemctl = "${lib.getExe' pkgs.systemd "systemctl"}";
|
||||
dex = "${lib.getExe pkgs.dex}";
|
||||
curl = "${lib.getExe pkgs.curl}";
|
||||
in
|
||||
pkgs.writeShellScript "ollama"
|
||||
''
|
||||
${notify-send} "Launching backend.." "Please be patient."
|
||||
${systemctl} --user start open-webui
|
||||
attempts=0
|
||||
success=false
|
||||
|
||||
while [[ $attempts -lt $((20*9)) ]]; do
|
||||
if [[ $(${curl} http://127.0.0.1:3021) ]]; then
|
||||
${notify-send} "Backend up." "Launching client.."
|
||||
success=true
|
||||
break
|
||||
else
|
||||
attempts=$((attempts+1))
|
||||
if [[ $(($attempts % 20)) -eq 0 ]]; then
|
||||
${notify-send} "Launching backend.." "Still launching.. ($((attempts/2))s)"
|
||||
fi
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
if [[ ! $success ]]; then
|
||||
${notify-send} "Failure" "Failed to launch backend!"
|
||||
${systemctl} --user kill open-webui
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 0.5 # give it a little time
|
||||
${dex} -w ~/.nix-profile/share/applications/OpenWebUI.desktop
|
||||
|
||||
${notify-send} "Goodbye" "Shutting down."
|
||||
${systemctl} --user stop open-webui
|
||||
exit 0
|
||||
''}";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue