Skip to content

Commit

Permalink
nixos/nvidia: make VA-API support optional
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
msanft committed Dec 13, 2024
1 parent afb08a9 commit fad6e19
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions nixos/modules/hardware/video/nvidia.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fad6e19

Please sign in to comment.