2023-08-01 12:48:49 -04:00
|
|
|
{ config, lib, pkgs, ...}: {
|
|
|
|
# Make sure opengl is enabled
|
|
|
|
hardware.opengl = {
|
|
|
|
enable = true;
|
|
|
|
driSupport = true;
|
|
|
|
driSupport32Bit = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Tell Xorg to use the nvidia driver (also valid for Wayland)
|
|
|
|
services.xserver.videoDrivers = [
|
|
|
|
# For the RTX 4000
|
|
|
|
"nvidia"
|
|
|
|
];
|
2023-08-01 13:43:04 -04:00
|
|
|
|
2023-08-01 13:23:57 -04:00
|
|
|
services.xserver.exportConfiguration = true;
|
2023-08-01 12:48:49 -04:00
|
|
|
hardware.nvidia = {
|
|
|
|
|
|
|
|
# Modesetting is needed for most Wayland compositors
|
|
|
|
modesetting.enable = true;
|
|
|
|
|
|
|
|
# Use the open source version of the kernel module
|
|
|
|
# Only available on driver 515.43.04+
|
2024-02-01 20:02:53 -05:00
|
|
|
# Seems to cause some issues with Tensorflow/CUDA/PyTorch
|
|
|
|
open = false;
|
2023-08-01 12:48:49 -04:00
|
|
|
|
|
|
|
# Enable the nvidia settings menu
|
|
|
|
nvidiaSettings = true;
|
|
|
|
|
|
|
|
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
|
|
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Allow Unfree, Nvidia, CUDA, and derived packages.
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
2024-02-01 20:02:53 -05:00
|
|
|
nixpkgs.config.cudaSupport = true;
|
2023-08-01 12:48:49 -04:00
|
|
|
|
2024-11-04 10:20:36 -05:00
|
|
|
# Add cuda to system environment
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
cudatoolkit
|
|
|
|
];
|
|
|
|
|
2023-08-01 12:48:49 -04:00
|
|
|
# Use Prebuilt Cached Versions of CUDA Packages
|
|
|
|
nix.settings = {
|
2024-02-01 20:02:53 -05:00
|
|
|
substituters = [
|
2023-08-01 12:48:49 -04:00
|
|
|
"https://cuda-maintainers.cachix.org"
|
|
|
|
];
|
|
|
|
trusted-public-keys = [
|
|
|
|
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|