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 /system | |
| parent | update stuff for work (diff) | |
| download | dotfiles-nix-d8a81597b7d33a7bed10fd5b6442700e912ed34d.tar.gz dotfiles-nix-d8a81597b7d33a7bed10fd5b6442700e912ed34d.tar.bz2 dotfiles-nix-d8a81597b7d33a7bed10fd5b6442700e912ed34d.zip | |
refactor nvidia/cuda
Diffstat (limited to 'system')
| -rw-r--r-- | system/default.nix | 2 | ||||
| -rw-r--r-- | system/nvidia.nix | 60 |
2 files changed, 55 insertions, 7 deletions
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" + ]); }; } |