From a75e2b362406dbf80f9bd9369dd999bcc9280fb9 Mon Sep 17 00:00:00 2001 From: s-prechtl Date: Tue, 4 Nov 2025 22:32:06 +0100 Subject: [PATCH] feat: make it go boom --- hosts/hitsugibune/configuration.nix | 1 + hosts/hitsugibune/llm.nix | 7 +++++ hosts/hitsugibune/nvidia.nix | 44 +++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 hosts/hitsugibune/nvidia.nix diff --git a/hosts/hitsugibune/configuration.nix b/hosts/hitsugibune/configuration.nix index 0fabc2b..004fcc0 100644 --- a/hosts/hitsugibune/configuration.nix +++ b/hosts/hitsugibune/configuration.nix @@ -35,6 +35,7 @@ in { ./matrix.nix ./mail.nix ./llm.nix + ./nvidia.nix inputs.mms.module ]; diff --git a/hosts/hitsugibune/llm.nix b/hosts/hitsugibune/llm.nix index a18ebb4..b41e09f 100644 --- a/hosts/hitsugibune/llm.nix +++ b/hosts/hitsugibune/llm.nix @@ -5,4 +5,11 @@ openFirewall = true; host = "0.0.0.0"; }; + + services.ollama = { + enable = true; + acceleration = "cuda"; + loadModels = [ "llama3.2:3b" "deepseek-r1:1.5b" "gpt-oss:20b" ]; + +}; } diff --git a/hosts/hitsugibune/nvidia.nix b/hosts/hitsugibune/nvidia.nix new file mode 100644 index 0000000..0cac856 --- /dev/null +++ b/hosts/hitsugibune/nvidia.nix @@ -0,0 +1,44 @@ +{config, lib, ...}: +{ + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "nvidia-x11" + "nvidia-settings" + ]; + # Enable OpenGL + hardware.graphics = { + enable = true; + }; + + # Load nvidia driver for Xorg and Wayland + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = false; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; +}