diff --git a/home/gunalx/niri.nix b/home/gunalx/niri.nix index b592049..482a1a8 100644 --- a/home/gunalx/niri.nix +++ b/home/gunalx/niri.nix @@ -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. diff --git a/machines/aragon/configuration.nix b/machines/aragon/configuration.nix index 1f56fa6..464842b 100644 --- a/machines/aragon/configuration.nix +++ b/machines/aragon/configuration.nix @@ -20,7 +20,7 @@ #customised applications ../../services/podman.nix ../../services/boinc.nix - ../../services/ollama.nix + ../../services/ollama-amd.nix ]; # Bootloader. diff --git a/machines/aragon/hardware-configuration.nix b/machines/aragon/hardware-configuration.nix index f0148bf..0f3f51b 100644 --- a/machines/aragon/hardware-configuration.nix +++ b/machines/aragon/hardware-configuration.nix @@ -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"]; diff --git a/services/ollama-amd.nix b/services/ollama-amd.nix new file mode 100644 index 0000000..2bb883d --- /dev/null +++ b/services/ollama-amd.nix @@ -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; + }; +} diff --git a/services/ollama.nix b/services/ollama.nix index 022767a..f992f72 100644 --- a/services/ollama.nix +++ b/services/ollama.nix @@ -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; }; }