From fad6e19f35182f7b179d50fea43595fdc517569b Mon Sep 17 00:00:00 2001 From: Moritz Sanft <58110325+msanft@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:09:00 +0100 Subject: [PATCH] nixos/nvidia: make VA-API support optional This adds a knob to disable VA-API support. For use-cases like AI servers, which do not need to perform video acceleration, this can be a useful tweak to reduce size of the system closure a lot, as the VA-API drivers are heavy. Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> --- nixos/modules/hardware/video/nvidia.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix index 3d3165e44913d..707b4b3242358 100644 --- a/nixos/modules/hardware/video/nvidia.nix +++ b/nixos/modules/hardware/video/nvidia.nix @@ -274,6 +274,14 @@ in config.hardware.nvidia.open == true || lib.versionAtLeast config.hardware.nvidia.package.version "555" ''; }; + + videoAcceleration = + (lib.mkEnableOption '' + Whether video acceleration (VA-API) should be enabled. + '') + // { + default = true; + }; }; }; @@ -504,9 +512,7 @@ in "egl/egl_external_platform.d".source = "/run/opengl-driver/share/egl/egl_external_platform.d/"; }; - hardware.graphics = { - extraPackages = [ pkgs.nvidia-vaapi-driver ]; - }; + hardware.graphics.extraPackages = lib.optional cfg.videoAcceleration pkgs.nvidia-vaapi-driver; environment.systemPackages = lib.optional cfg.nvidiaSettings nvidia_x11.settings