aragon ollama niri

This commit is contained in:
2025-05-21 13:06:54 +02:00
parent a0831e42e1
commit 829275d044
5 changed files with 125 additions and 44 deletions

View File

@@ -194,6 +194,8 @@ layout {
// Offset moves the shadow relative to the window.
offset x=0 y=5
// You can also change the shadow color and opacity.
color "#0007"
}
@@ -343,6 +345,8 @@ binds {
Mod+Return { spawn "foot"; }
Mod+D { spawn "fuzzel"; }
Super+M { spawn "swaylock"; }
Mod+Escape { toggle-keyboard-shortcuts-inhibit; } //for diabling niri shortcuts for a while.
// You can also use a shell. Do this if you need pipes, multiple commands, etc.
// Note: the entire command goes as a single argument in the end.

View File

@@ -20,7 +20,7 @@
#customised applications
../../services/podman.nix
../../services/boinc.nix
../../services/ollama.nix
../../services/ollama-amd.nix
];
# Bootloader.

View File

@@ -13,7 +13,15 @@
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
hardware.amdgpu.opencl.enable = true;
hardware.amdgpu.amdvlk.enable = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
hardware.graphics = {
enable = true;
};
services.xserver.videoDrivers = [ "amdgpu" ];
systemd.tmpfiles.rules = [
"L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}"
@@ -21,11 +29,30 @@
nixpkgs.config.rocmSupport = true;
environment.variables = {
HSA_OVERRIDE_GFX_VERSION="10.3.0";
};
#hardware.opengl.extraPackages32 = with pkgs; [
# driversi686Linux.amdvlk
#];
environment.systemPackages = with pkgs; [ lact ];
environment.systemPackages = with pkgs; [
lact
rocmPackages.rocminfo
rocmPackages.rocm-smi
rocmPackages.rocm-runtime
rocmPackages.rocm-device-libs
rocmPackages.rocm-core
rocmPackages.rocm-cmake
rocmPackages.rocgdb
rocmPackages.rocblas
rocmPackages.rccl
];
systemd.packages = with pkgs; [ lact ];
systemd.services.lactd.wantedBy = ["multi-user.target"];

54
services/ollama-amd.nix Normal file
View File

@@ -0,0 +1,54 @@
{ config, pkgs, lib, ... }:
{
# Add Ollama to system packages
environment.systemPackages = [ pkgs.unstable.ollama ];
# Ollama configuration
services.ollama = {
enable = true;
package = pkgs.unstable.ollama;
host = "0.0.0.0";
openFirewall = true;
port = 11434;
home = "/var/lib/ollama";
# Preloaded models
loadModels = [
"gemma3:1b"
"qwen3:8b"
"qwen3:0.6b"
"llama3.1"
"moondream"
"minicpm-v"
"qwen2.5vl:3b"
"gemma3:4b"
"granite3.2-vision"
"zylonai/multilingual-e5-large"
"nomic-embed-text"
"snowflake-arctic-embed2"
];
# Environment variables based on hostname
environmentVariables = {
"HIP_VISIBLE_DEVICES" = "0,1";
"OLLAMA_LLM_LIBRARY" = "rocm";
};
rocmOverrideGfx = "10.3.0"; #rdna2
# Acceleration settings
acceleration = "rocm";
};
# NGINX reverse proxy configuration
services.nginx.virtualHosts."ollama.${config.networking.hostName}.${config.networking.domain}" = {
forceSSL = true;
locations."/" = {
proxyWebsockets = true;
proxyPass = "http://${config.services.ollama.listenAddress}";
};
basicAuthFile = config.sops.secrets."nginx/defaultpass".path;
};
}

View File

@@ -1,52 +1,48 @@
{ config, pkgs, lib, ... }:
let
hostname = config.networking.hostName;
in
{
environment.systemPackages = [
pkgs.unstable.ollama
];
# Add Ollama to system packages
environment.systemPackages = [ pkgs.unstable.ollama ];
# Ollama configuration
services.ollama = {
enable = true;
package = pkgs.unstable.ollama;
host = "0.0.0.0";
openFirewall = true;
port = 11434;
home = "/var/lib/ollama";
enable = true;
package = pkgs.unstable.ollama;
host = "0.0.0.0";
openFirewall = true;
port = 11434;
home = "/var/lib/ollama";
loadModels = [
"gemma3:1b"
"qwen3:8b"
"qwen3:0.6b"
"llama3.1"
# Preloaded models
loadModels = [
"gemma3:1b"
"qwen3:8b"
"qwen3:0.6b"
"llama3.1"
"moondream"
"minicpm-v"
"qwen2.5vl:3b"
"gemma3:4b"
"granite3.2-vision"
"zylonai/multilingual-e5-large"
"nomic-embed-text"
"snowflake-arctic-embed2"
];
"moondream"
"minicpm-v"
"qwen2.5vl:3b"
"gemma3:4b"
"granite3.2-vision"
# Acceleration settings
acceleration = "cuda";
"zylonai/multilingual-e5-large"
"nomic-embed-text"
"snowflake-arctic-embed2"
];
};
#possibly a flawed idea, should just set cudaSupport and rocm support.
services.ollama.acceleration = lib.mkDefault ( let
hostname = config.networking.hostName;
in
if hostname == "galadriel" then "cuda"
else if hostname == "aragorn" then "rocm"
else null);
# NGINX reverse proxy configuration
services.nginx.virtualHosts."ollama.${config.networking.hostName}.${config.networking.domain}" = {
forceSSL = true;
#useACMEHost = config.networking.domain; #not sure if this will work, unless
locations."/" = {
proxyWebsockets = true;
proxyPass = "http://${config.services.ollama.listenAddress}";
};
basicAuthFile = config.sops.secrets."nginx/defaultpass".path;
forceSSL = true;
locations."/" = {
proxyWebsockets = true;
proxyPass = "http://${config.services.ollama.listenAddress}";
};
basicAuthFile = config.sops.secrets."nginx/defaultpass".path;
};
}