forked from wymiller/nix-config-v2
add: ollama waybar integration, modified cloud config to add ollama systemd service
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"layer": "top",
|
"layer": "top",
|
||||||
"modules-left": ["sway/workspaces"],
|
"modules-left": ["sway/workspaces"],
|
||||||
"modules-center": ["clock"],
|
"modules-center": ["clock"],
|
||||||
"modules-right": ["custom/playerctl", "custom/weather", "pulseaudio", "custom/network", "tray"],
|
"modules-right": ["custom/playerctl", "custom/weather", "pulseaudio", "custom/network", "custom/ollama", "tray"],
|
||||||
"sway/workspaces": {
|
"sway/workspaces": {
|
||||||
"disable-scroll": true,
|
"disable-scroll": true,
|
||||||
"all-outputs": true,
|
"all-outputs": true,
|
||||||
@@ -42,6 +42,14 @@
|
|||||||
"interval": 5,
|
"interval": 5,
|
||||||
"tooltip": false
|
"tooltip": false
|
||||||
},
|
},
|
||||||
|
"custom/ollama": {
|
||||||
|
"format": "{text}",
|
||||||
|
"return-type": "json",
|
||||||
|
"exec": "bash $HOME/.config/waybar/ollama.sh",
|
||||||
|
"on-click": "bash $HOME/.config/waybar/ollama.sh toggle",
|
||||||
|
"interval": 2,
|
||||||
|
"tooltip": true
|
||||||
|
},
|
||||||
"pulseaudio": {
|
"pulseaudio": {
|
||||||
"format": "{icon} {volume}%",
|
"format": "{icon} {volume}%",
|
||||||
"format-bluetooth": "{icon} {volume}%",
|
"format-bluetooth": "{icon} {volume}%",
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -u
|
||||||
|
|
||||||
|
service=ollama.service
|
||||||
|
|
||||||
|
# The shared Waybar config is also used by hosts without Ollama.
|
||||||
|
if ! systemctl --user cat "$service" >/dev/null 2>&1; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${1:-} == toggle ]]; then
|
||||||
|
if systemctl --user is-active --quiet "$service"; then
|
||||||
|
systemctl --user stop "$service"
|
||||||
|
else
|
||||||
|
systemctl --user start "$service"
|
||||||
|
fi
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if systemctl --user is-active --quiet "$service"; then
|
||||||
|
printf '%s\n' '{"text":"<span foreground=\"#9ece6a\">●</span> Local AI","tooltip":"Ollama is running. Click to stop it.","class":"running"}'
|
||||||
|
else
|
||||||
|
printf '%s\n' '{"text":"<span foreground=\"#f7768e\">●</span> Local AI","tooltip":"Ollama is stopped. Click to start it.","class":"stopped"}'
|
||||||
|
fi
|
||||||
@@ -32,10 +32,11 @@ window#waybar {
|
|||||||
#memory,
|
#memory,
|
||||||
#pulseaudio,
|
#pulseaudio,
|
||||||
#custom-network,
|
#custom-network,
|
||||||
|
#custom-ollama,
|
||||||
#battery,
|
#battery,
|
||||||
#clock,
|
#clock,
|
||||||
#custom-playerctl {
|
#custom-playerctl {
|
||||||
padding: 0 10px;
|
padding: 0 5px;
|
||||||
margin: 0 5px;
|
margin: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ in {
|
|||||||
xdg.configFile."waybar/config".source = lib.mkForce (dirs.defaults + /waybar/config);
|
xdg.configFile."waybar/config".source = lib.mkForce (dirs.defaults + /waybar/config);
|
||||||
xdg.configFile."waybar/style.css".source = lib.mkForce (dirs.defaults + /waybar/style.css);
|
xdg.configFile."waybar/style.css".source = lib.mkForce (dirs.defaults + /waybar/style.css);
|
||||||
xdg.configFile."waybar/network.sh".source = dirs.defaults + /waybar/network.sh;
|
xdg.configFile."waybar/network.sh".source = dirs.defaults + /waybar/network.sh;
|
||||||
|
xdg.configFile."waybar/ollama.sh".source = dirs.defaults + /waybar/ollama.sh;
|
||||||
|
|
||||||
home.packages = with pkgs; [ curl iproute2 networkmanager ];
|
home.packages = with pkgs; [ curl iproute2 networkmanager ];
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,18 @@ in {
|
|||||||
vlc
|
vlc
|
||||||
];
|
];
|
||||||
|
|
||||||
|
systemd.user.services.ollama = {
|
||||||
|
description = "Ollama local AI server";
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${pkgs.ollama-rocm}/bin/ollama serve";
|
||||||
|
Restart = "on-failure";
|
||||||
|
Environment = [
|
||||||
|
"OLLAMA_HOST=0.0.0.0:11434"
|
||||||
|
"OLLAMA_CONTEXT_LENGTH=64000"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Enable Polkit
|
# Enable Polkit
|
||||||
security.polkit.enable = true;
|
security.polkit.enable = true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user