nixos-config/modules/common/hardware.nix

27 lines
533 B
Nix

{ lib, config, pkgs, ... }:
with lib;
{
options.hwAccelerationGPU = mkOption {
type = types.nullOr (types.enum [ "nvidia" "intel" ]);
default = null;
example = "nvidia";
description = ''
The GPU type.
'';
};
config = {
hardware.opengl = {
enable = config.hwAccelerationGPU != null;
extraPackages = with pkgs; [
libvdpau-va-gl
vaapiVdpau
];
};
services.xserver.videoDrivers = [
(mkIf (config.hwAccelerationGPU == "nvidia") "nouveau")
];
};
}