diff options
| author | Freya Murphy <freya@freyacat.org> | 2026-03-10 18:34:56 -0400 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2026-03-10 18:35:06 -0400 |
| commit | d8a81597b7d33a7bed10fd5b6442700e912ed34d (patch) | |
| tree | 2547a56e81b8c558d727576dca6fa625a5df6c74 | |
| parent | update stuff for work (diff) | |
| download | dotfiles-nix-d8a81597b7d33a7bed10fd5b6442700e912ed34d.tar.gz dotfiles-nix-d8a81597b7d33a7bed10fd5b6442700e912ed34d.tar.bz2 dotfiles-nix-d8a81597b7d33a7bed10fd5b6442700e912ed34d.zip | |
| -rw-r--r-- | home/apps/obs.nix | 10 | ||||
| -rw-r--r-- | hosts/shinji/default.nix | 2 | ||||
| -rw-r--r-- | hosts/shinji/hardware.nix | 2 | ||||
| -rw-r--r-- | lib/default.nix | 1 | ||||
| -rw-r--r-- | options.nix | 3 | ||||
| -rw-r--r-- | shells/cuda.nix | 46 | ||||
| -rw-r--r-- | shells/default.nix | 13 | ||||
| -rw-r--r-- | system/default.nix | 2 | ||||
| -rw-r--r-- | system/nvidia.nix | 60 |
9 files changed, 64 insertions, 75 deletions
diff --git a/home/apps/obs.nix b/home/apps/obs.nix index e67190b..4c4fed5 100644 --- a/home/apps/obs.nix +++ b/home/apps/obs.nix @@ -11,13 +11,9 @@ in { programs.obs-studio = { enable = true; - package = - if config.nvidia.enable - then - (pkgs.obs-studio.override { - cudaSupport = true; - }) - else pkgs.obs-studio; + package = pkgs.obs-studio.override { + cudaSupport = config.nvidia.cuda.enable; + }; plugins = with pkgs.obs-studio-plugins; [ obs-backgroundremoval diff --git a/hosts/shinji/default.nix b/hosts/shinji/default.nix index 828fd02..865524a 100644 --- a/hosts/shinji/default.nix +++ b/hosts/shinji/default.nix @@ -64,7 +64,6 @@ apps = { caelestia.enable = true; hyprlock.enable = true; - rofi.enable = true; kanshi.enable = true; kitty.enable = true; obs.enable = true; @@ -102,6 +101,7 @@ tpm.enable = true; nvidia = { enable = true; + cuda.enable = true; primeBusIds = { amdgpuBusId = "PCI:115:0:0"; nvidiaBusId = "PCI:1:0:0"; diff --git a/hosts/shinji/hardware.nix b/hosts/shinji/hardware.nix index b35c2a2..e79deb0 100644 --- a/hosts/shinji/hardware.nix +++ b/hosts/shinji/hardware.nix @@ -32,7 +32,7 @@ "vfio" ]; boot.kernelModules = ["kvm-amd"]; - boot.blacklistedKernelModules = ["nouveau"]; + boot.blacklistedKernelModules = []; boot.kernelParams = []; boot.extraModulePackages = []; boot.supportedFilesystems = ["ntfs"]; diff --git a/lib/default.nix b/lib/default.nix index 7fa783b..b501184 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -20,6 +20,7 @@ in { fingerprint network tpm + nvidia minimal # Primary User user diff --git a/options.nix b/options.nix index e2e9067..42097b0 100644 --- a/options.nix +++ b/options.nix @@ -306,6 +306,9 @@ in { enable = mkEnableOption { description = "Enable the nvidia graphics driver"; }; + cuda.enable = mkEnableOption { + description = "Enable cuda support and modules"; + }; primeBusIds = mkOption { type = types.attrs; description = "Set of nvidia prime gpu bus ids"; diff --git a/shells/cuda.nix b/shells/cuda.nix deleted file mode 100644 index 80cbc9b..0000000 --- a/shells/cuda.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - pkgs, - lib, -}: let - nvidiaPackage = pkgs.linuxPackages_latest.nvidiaPackages.stable; - libs = with pkgs; [ - # CUDA - cudaPackages.cuda_cudart - cudaPackages.cuda_nvcc - cudaPackages.cuda_cccl - cudaPackages.cudnn - cudaPackages.nsight_compute - cudatoolkit - nvidiaPackage - - # OpenGL - libGLU - libGL - freeglut - - # X11 - libxi - libxmu - libxext - libx11 - libxv - libxrandr - - # Dev Tools - ffmpeg - zlib - gcc - binutils - ]; -in { - packages = libs; - LD_LIBRARY_PATH = lib.makeLibraryPath libs; - - shellHook = '' - # Nvidia Driver setup - export NVIDIA_VISIBLE_DEVICES=all - export NVIDIA_DRIVER_CAPABILITIES=compute,utility - export CUDA_VISIBLE_DEVICES=0 - export CUDA_PATH=${pkgs.cudatoolkit} - ''; -} diff --git a/shells/default.nix b/shells/default.nix index 22a7ee3..2226294 100644 --- a/shells/default.nix +++ b/shells/default.nix @@ -11,19 +11,6 @@ ]; }; - # Loads Nvidia CUDA - cuda = pkgs.mkShell (import ./cuda.nix { - pkgs = import inputs.nixpkgs { - inherit system; - config = { - allowUnfree = true; - cudaSupport = true; - cudaVersion = "12"; - }; - }; - lib = inputs.nixpkgs.lib; - }); - # VST development with windows VST3 support though yabridge/wine vst = pkgs.mkShell (import ./vst.nix { pkgs = import inputs.nixpkgs { diff --git a/system/default.nix b/system/default.nix index 09f8076..f401753 100644 --- a/system/default.nix +++ b/system/default.nix @@ -56,8 +56,6 @@ tmpfsSize = "50%"; }; - services.seatd.enable = true; - # use system packages in home manager home-manager.useGlobalPkgs = true; diff --git a/system/nvidia.nix b/system/nvidia.nix index ff38b04..810f685 100644 --- a/system/nvidia.nix +++ b/system/nvidia.nix @@ -4,11 +4,15 @@ pkgs, ... }: let - inherit (lib) mkIf; + inherit (lib) mkIf optionals; cfg = config.nvidia; in { config = mkIf cfg.enable { + # kernel modules + boot.blacklistedKernelModules = ["nouveau"]; services.xserver.videoDrivers = ["modesetting" "nvidia"]; + + # nvidia driver hardware.nvidia = { modesetting.enable = true; powerManagement = { @@ -27,9 +31,55 @@ in { nvidiaSettings = true; package = config.boot.kernelPackages.nvidiaPackages.latest; }; - unfreePackages = [ - "nvidia-x11" - "nvidia-settings" - ]; + + # cuda + environment = mkIf cfg.cuda.enable { + systemPackages = with pkgs; [ + cudaPackages.cuda_cudart + cudaPackages.cudnn + cudatoolkit + ]; + variables = { + NVIDIA_VISIBLE_DEVICES = "all"; + NVIDIA_DRIVER_CAPABILITIES = "compute,utility"; + CUDA_VISIBLE_DEVICES = 0; + CUDA_PATH = "${pkgs.cudatoolkit}"; + }; + }; + nix.settings = mkIf cfg.cuda.enable { + substituters = ["https://cache.nixos-cuda.org"]; + trusted-public-keys = ["cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M="]; + }; + + unfreePackages = + [ + "nvidia-x11" + "nvidia-settings" + ] + ++ (optionals cfg.cuda.enable [ + "cuda-merged" + "cuda_cccl" + "cuda_cudart" + "cuda_cuobjdump" + "cuda_cupti" + "cuda_cuxxfilt" + "cuda_gdb" + "cuda_nvcc" + "cuda_nvdisasm" + "cuda_nvml_dev" + "cuda_nvprune" + "cuda_nvrtc" + "cuda_nvtx" + "cuda_profiler_api" + "cuda_sanitizer_api" + "cudnn" + "libcublas" + "libcufft" + "libcurand" + "libcusolver" + "libcusparse" + "libnpp" + "libnvjitlink" + ]); }; } |