nixos/modules/hardware/graphics/default.nix
Felix Buehler ca9a3149a5
Some checks are pending
/ Build Nix targets (push) Waiting to run
hardware/graphics: add AMD option
2025-05-04 13:41:46 +02:00

54 lines
1.2 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.hardware.graphics;
in
{
options.my.hardware.graphics = with lib; {
enable = mkEnableOption "graphics configuration";
cpuFlavor = mkOption {
type =
with types;
nullOr (enum [
"amd"
"intel"
]);
default = null;
example = "intel";
description = "Which kind of GPU";
};
};
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
hardware.graphics.enable = true;
}
# Intel GPU
(lib.mkIf (cfg.cpuFlavor == "intel") {
nixpkgs.config.packageOverrides = pkgs: {
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
};
hardware.graphics.extraPackages = with pkgs; [
intel-media-driver # LIBVA_DRIVER_NAME=iHD
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
vaapiVdpau
libvdpau-va-gl
];
})
(lib.mkIf (cfg.cpuFlavor == "amd") {
hardware.graphics.extraPackages = with pkgs; [
amdvlk
];
hardware.graphics.extraPackages32 = with pkgs; [
driversi686Linux.amdvlk
];
})
]
);
}