1
1
Fork 0

custom: add ollama service

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2025-03-14 16:48:08 -05:00
parent 2b65c09875
commit c592e0f1ab
Signed by: Myned
GPG key ID: C7224454F7881A34
9 changed files with 90 additions and 9 deletions
machines
options/custom

View file

@ -27,6 +27,10 @@
abiotic-factor = true;
};
hardware = {
gpu = "amd";
};
storage.mnt = [
"gayme"
"gaymer"

View file

@ -15,14 +15,34 @@
width = 2256;
height = 1504;
scale = 1.5;
desktops.niri.output.connectors = ["eDP-1"];
desktops = {
niri.output.connectors = ["eDP-1"];
};
# BUG: Phoenix support not currently functional
# https://github.com/Cryolitia/ryzen_smu/issues/1
#// programs.ryzenadj.enable = true;
programs = {
#// ryzenadj.enable = true;
};
services.fw-fanctrl.enable = true;
#// settings.storage.mnt = ["myve"];
services = {
fw-fanctrl.enable = true;
# https://github.com/ollama/ollama/blob/main/docs/gpu.md#overrides
#?? nix run nixpkgs#rocmPackages.rocminfo | grep gfx
ollama.rocmOverrideGfx = "10.3.0"; # 10.3.1
};
settings = {
hardware = {
gpu = "amd";
};
storage = {
mnt = ["myve"];
};
};
};
services.keyd.keyboards.default.settings.main.rightcontrol = "layer(altgr)"; # No Ctrl_R

View file

@ -182,6 +182,12 @@ case "$1" in
url="https://wiki.nixos.org/w/index.php?search="
query="${1:3}"
;;
'o '*)
label="Ollama"
icon="ollama"
url="https://ollama.com/search?q="
query="${1:2}"
;;
'p '*)
label="Piped"
icon="youtube"

View file

@ -244,6 +244,12 @@ in {
url = "https://wiki.nixos.org/w/index.php?search={searchTerms}";
}
{
name = "Ollama";
shortcut = "o";
url = "https://ollama.com/search?q={searchTerms}";
}
{
name = "Piped";
shortcut = "p";

View file

@ -479,6 +479,12 @@ with lib; {
urls = [{template = "https://wiki.nixos.org/w/index.php?search={searchTerms}";}];
};
"Ollama" = {
definedAliases = ["o"];
iconUpdateURL = "https://ollama.com/public/icon-64x64.png";
urls = [{template = "https://ollama.com/search?q={searchTerms}";}];
};
"Piped" = {
definedAliases = ["p"];
iconUpdateURL = "https://piped.${config.custom.domain}/favicon.ico";

View file

@ -45,6 +45,7 @@ with lib; {
keyd.enable = true;
#// mako.enable = true;
#// network-manager-applet.enable = true;
ollama.enable = true;
power-profiles-daemon.enable = true;
samba.enable = true;
#// swayidle.enable = true;

View file

@ -0,0 +1,27 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.custom.services.ollama;
in {
options.custom.services.ollama = {
enable = mkOption {default = false;};
};
config = mkIf cfg.enable {
# https://ollama.com/
# https://wiki.nixos.org/wiki/Ollama
services.ollama = {
enable = true;
openFirewall = true;
package = pkgs.ollama-rocm;
loadModels = [
"deepseek-r1" # https://github.com/deepseek-ai/DeepSeek-R1
];
};
};
}

View file

@ -6,12 +6,22 @@
with lib; let
cfg = config.custom.settings.hardware;
in {
options.custom.settings.hardware.enable = mkOption {default = false;};
options.custom.settings.hardware = {
enable = mkOption {default = false;};
gpu = mkOption {default = null;};
};
config.hardware = mkIf cfg.enable {
enableAllFirmware = config.custom.default; # Non-free firmware
config = mkIf cfg.enable {
hardware = {
enableAllFirmware = config.custom.default; # Non-free firmware
# https://wiki.nixos.org/wiki/Bluetooth
bluetooth.enable = config.custom.minimal;
# https://wiki.nixos.org/wiki/Bluetooth
bluetooth.enable = config.custom.minimal;
};
nixpkgs.config = {
cudaSupport = mkIf (cfg.gpu == "nvidia") true;
rocmSupport = mkIf (cfg.gpu == "amd") true;
};
};
}

View file

@ -74,6 +74,7 @@ in {
]
++ optionals config.custom.full [
### GUI applications
alpaca # AI client
amberol # Audio player
apostrophe # Markdown editor
baobab # Disk usage analyzer