diff options
author | Thiago Kenji Okada <thiagokokada@gmail.com> | 2022-06-17 18:59:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-17 18:59:32 +0100 |
commit | 4cf04594a9b5fe7d226ef611023528f6e3a669db (patch) | |
tree | 045fb06fcfb545ffd03f7e5c98033c617a22f981 /nixos/modules/hardware | |
parent | a523fc3d1a84c2ded45fba2fbf9a3f2d999a04a0 (diff) | |
parent | 6959d265b8c9cca53a9f5dafd435afec242d2c62 (diff) |
Merge pull request #172660 from NickCao/nvidia-open
nvidia-open: init at 515.43.04
Diffstat (limited to 'nixos/modules/hardware')
-rw-r--r-- | nixos/modules/hardware/video/nvidia.nix | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix index a9b04bcc85959..b4717719661aa 100644 --- a/nixos/modules/hardware/video/nvidia.nix +++ b/nixos/modules/hardware/video/nvidia.nix @@ -183,6 +183,14 @@ in ''; example = literalExpression "config.boot.kernelPackages.nvidiaPackages.legacy_340"; }; + + hardware.nvidia.open = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Whether to use the open source kernel module + ''; + }; }; config = let @@ -231,6 +239,11 @@ in ); message = "Required files for driver based power management don't exist."; } + + { + assertion = cfg.open -> (cfg.package ? open && cfg.package ? firmware); + message = "This version of NVIDIA driver does not provide a corresponding opensource kernel driver"; + } ]; # If Optimus/PRIME is enabled, we: @@ -364,7 +377,8 @@ in ++ optional (nvidia_x11.persistenced != null && config.virtualisation.docker.enableNvidia) "L+ /run/nvidia-docker/extras/bin/nvidia-persistenced - - - - ${nvidia_x11.persistenced}/origBin/nvidia-persistenced"; - boot.extraModulePackages = [ nvidia_x11.bin ]; + boot.extraModulePackages = if cfg.open then [ nvidia_x11.open ] else [ nvidia_x11.bin ]; + hardware.firmware = lib.optional cfg.open nvidia_x11.firmware; # nvidia-uvm is required by CUDA applications. boot.kernelModules = [ "nvidia-uvm" ] ++ @@ -372,7 +386,8 @@ in # If requested enable modesetting via kernel parameter. boot.kernelParams = optional (offloadCfg.enable || cfg.modesetting.enable) "nvidia-drm.modeset=1" - ++ optional cfg.powerManagement.enable "nvidia.NVreg_PreserveVideoMemoryAllocations=1"; + ++ optional cfg.powerManagement.enable "nvidia.NVreg_PreserveVideoMemoryAllocations=1" + ++ optional cfg.open "nvidia.NVreg_OpenRmEnableUnsupportedGpus=1"; services.udev.extraRules = '' |