From d67494972d1b59b1992031aebeb27e07c1520da9 Mon Sep 17 00:00:00 2001 From: Colin L Rice Date: Thu, 18 Apr 2019 18:51:35 -0400 Subject: [PATCH] nixos/nvidia: Add NVIDIA optimus option to allow external GPUs Without this option - NVIDIA refuses to use an external GPU. --- nixos/modules/hardware/video/nvidia.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix index 80ea7bc5d5c9..9f2360f41c6e 100644 --- a/nixos/modules/hardware/video/nvidia.nix +++ b/nixos/modules/hardware/video/nvidia.nix @@ -79,6 +79,14 @@ in ''; }; + hardware.nvidia.optimus_prime.allowExternalGpu = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Configure X to allow external NVIDIA GPUs when using optimus. + ''; + }; + hardware.nvidia.optimus_prime.nvidiaBusId = lib.mkOption { type = lib.types.string; default = ""; @@ -134,6 +142,7 @@ in deviceSection = optionalString optimusCfg.enable '' BusID "${optimusCfg.nvidiaBusId}" + ${optionalString optimusCfg.allowExternalGpu "Option \"AllowExternalGpus\""} ''; screenSection = ''