62 lines
2.0 KiB
Nix
Raw Permalink Normal View History

2024-01-14 19:10:42 +01:00
{ config, lib, pkgs, ... }:
{
# Enable OpenGL
2024-12-08 14:34:58 +01:00
hardware.graphics = {
2024-01-14 19:10:42 +01:00
enable = true;
2024-12-08 14:34:58 +01:00
enable32Bit = true;
2024-01-14 19:10:42 +01:00
};
2025-01-29 12:51:19 +01:00
nixpkgs.config = {
allowUnfree = true;
cudaSupport = true;
};
2024-01-14 19:10:42 +01:00
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = ["nvidia"];
boot.initrd.kernelModules = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
#powerManagement.enable = true;
2024-12-07 14:34:16 +01:00
# Fine-grained power management. Turns off GPU when not in use. Experimental and only works on modern Nvidia GPUs (Turing or newer).
#powerManagement.finegrained = true;
2024-12-07 14:34:16 +01:00
# Use the NVidia open source kernel module (not to be confused with the independent third-party "nouveau" open source driver).
# Currently alpha-quality/buggy, so false is currently the recommended setting.
2025-01-29 12:51:19 +01:00
open = false; #need proprietary for cuda.
2024-01-14 19:10:42 +01:00
2024-12-07 14:34:16 +01:00
# Enable the Nvidia settings menu, accessible via `nvidia-settings`.
2024-03-22 12:55:22 +01:00
#nvidiaSettings = true;
2024-01-14 19:10:42 +01:00
2024-03-22 12:55:22 +01:00
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
2024-01-14 21:00:30 +01:00
2024-03-22 12:55:22 +01:00
# Enable the CUDA toolkit
#install packages
2025-01-29 12:51:19 +01:00
environment.systemPackages = with pkgs; [
2024-12-07 14:34:16 +01:00
cudaPackages.cudatoolkit
2025-01-29 12:51:19 +01:00
cudaPackages.cudnn
2024-05-31 13:59:46 +02:00
nvtopPackages.nvidia
2025-01-29 12:51:19 +01:00
gcc
cudaPackages.nccl
cmake
#llama-cpp
#python3Packages.pip
#cudaPackages.cuda_cudart
#xgboostWithCuda
#libxcrypt-legacy
#cudaPackages.setupCudaHook
#cudaPackages.markForCudatoolkitRootHook
#cudaPackages.cuda_cudart.static
pkgs.cudaPackages.libcublas
#cudaPackages.tensorrt_8_6_0 #needs to be added manually, to the store and is a pain because of the license agreement and garbage collection
2025-01-29 12:51:19 +01:00
2024-03-22 12:55:22 +01:00
];
2024-01-14 21:00:30 +01:00
2024-12-07 14:34:16 +01:00
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"cuda_cudart"
];
2024-01-14 21:00:30 +01:00
2024-12-07 14:34:16 +01:00
}