blob: bfa9e09f8a30e3452c5504705ebdc31958c6984b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
{ config, lib, ... }:
let
isNvidiaEnabled = lib.elem "nvidia" config.services.xserver.videoDrivers;
# Unlike Nixpkgs, I know all of my GPUs should prefer the open modules after 560
useOpenModulesByDefault = lib.versionAtLeast config.hardware.nvidia.package.version "560";
in
{
config = lib.mkMerge [
{
hardware.nvidia = {
open = useOpenModulesByDefault;
# We usually want this to make suspend, etc. work
powerManagement.enable = lib.mkDefault true;
};
}
(lib.mkIf config.virtualisation.podman.enable {
hardware = {
nvidia-container-toolkit.enable = true;
};
})
(lib.mkIf (isNvidiaEnabled && !config.hardware.nvidia.open) {
# Don't use GSP Firmware on proprietary driver
# TODO: Remove when the following is fixed
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/693
boot.kernelParams = [
"nvidia.NVreg_EnableGpuFirmware=0"
];
})
];
}
|