nix-dotfiles/machines/galadriel/nvidia.nix

44 lines
1.5 KiB
Nix
Raw 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
};
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.
2024-03-22 12:55:22 +01:00
open = false;
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
environment.systemPackages = with pkgs; [
2024-12-07 14:34:16 +01:00
cudaPackages.cudnn
cudaPackages.cudatoolkit
2024-05-31 13:59:46 +02:00
nvtopPackages.nvidia
#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
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
}