initial commit
This commit is contained in:
36
modules/services/nvidia.nix
Normal file
36
modules/services/nvidia.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.my.services.nvidia.enable = lib.mkEnableOption "NVIDIA GPU drivers and CUDA";
|
||||
config = lib.mkIf config.my.services.nvidia.enable {
|
||||
environment.variables.CUDA_CACHE_PATH = "\${XDG_CACHE_HOME}/nv";
|
||||
boot.kernelParams = lib.mkIf (config.networking.hostName == "workstation") [ "nvidia-drm.fbdev=1" ];
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
hardware = {
|
||||
graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
extraPackages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
nvidia-vaapi-driver
|
||||
vaapiVdpau
|
||||
libvdpau-va-gl
|
||||
vulkan-loader
|
||||
mesa
|
||||
;
|
||||
};
|
||||
};
|
||||
nvidia = {
|
||||
open = config.networking.hostName == "workstation";
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = true;
|
||||
powerManagement.finegrained = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user