Skip to content

Commit

Permalink
Ollama, gpu load in waybar
Browse files Browse the repository at this point in the history
  • Loading branch information
amadejkastelic committed Aug 31, 2024
1 parent 7fd4c43 commit d227f6f
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 60 deletions.
92 changes: 42 additions & 50 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,10 @@
inputs.nixpkgs.follows = "nixpkgs";
};

anyrun.url = "github:fufexan/anyrun";
anyrun.url = "github:anyrun-org/anyrun";

chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";

gross = {
url = "github:fufexan/gross";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-parts.follows = "flake-parts";
};

helix.url = "github:helix-editor/helix";

hm = {
Expand Down
8 changes: 8 additions & 0 deletions home/editors/vscode/extensions.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@

# Python
ms-python.python
ms-python.debugpy
ms-python.flake8
ms-python.vscode-pylance
ms-python.black-formatter

# TOML
tamasfe.even-better-toml

# AI
ex3ndr.llama-coder

# Docker
ms-azuretools.vscode-docker
])
Expand Down
17 changes: 16 additions & 1 deletion home/programs/wayland/waybar/settings.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{...}: {
{
pkgs,
lib,
...
}: {
# https://www.nerdfonts.com/cheat-sheet

home.packages = [pkgs.radeontop];

programs.waybar.settings.mainBar = {
position = "top";
layer = "top";
Expand All @@ -19,6 +27,7 @@
"cpu"
"memory"
"disk"
"custom/gpu-usage"
"pulseaudio"
"custom/blue-light-filter"
"network"
Expand Down Expand Up @@ -106,5 +115,11 @@
on-click = "hyprshade toggle night-light";
tooltip = false;
};
"custom/gpu-usage" = {
exec = "${lib.getExe pkgs.radeontop} -d - -l 1 | tr -d '\n' | cut -s -d ',' -f3 | cut -s -d ' ' -f3 | tr -d '%' | awk '{ print int($1) }' | tr -d '\n'";
format = "󰢮 {}%";
interval = 2;
format-tooltip = "GPU Usage";
};
};
}
7 changes: 6 additions & 1 deletion home/programs/wayland/waybar/style.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ in {
color: #b4befe;
}
#tray, #pulseaudio, #network, #cpu, #memory, #disk, #clock, #custom-blue-light-filter {
#tray, #pulseaudio, #network, #cpu, #memory, #disk, #custom-gpu-usage, #clock, #custom-blue-light-filter {
font-size: ${custom.font_size};
color: ${custom.text_color};
}
Expand All @@ -61,10 +61,15 @@ in {
padding-right: 9px;
}
#disk {
padding-left: 9px;
padding-right: 9px;
}
#custom-gpu-usage {
padding-left: 9px;
padding-right: 15px;
}
#tray {
padding: 0 20px;
margin-left: 7px;
Expand Down
2 changes: 1 addition & 1 deletion system/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let

./services
./services/greetd.nix
#./services/sddm.nix
./services/ollama.nix
./services/pipewire.nix
./services/gpg.nix
./services/printing.nix
Expand Down
20 changes: 20 additions & 0 deletions system/services/ollama.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{pkgs, ...}: let
port = 11434;
in {
services.ollama = {
enable = true;
package = pkgs.ollama-rocm;
port = port;
loadModels = ["llama3.1" "stable-code:3b-code-q4_0"];
acceleration = "rocm";
rocmOverrideGfx = "10.3.0";
};

nixpkgs.config.rocmSupport = true;

services.nextjs-ollama-llm-ui = {
enable = true;
port = 3000;
ollamaUrl = "http://127.0.0.1:${toString port}";
};
}

0 comments on commit d227f6f

Please sign in to comment.