You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.2 KiB
Nix

{
config,
lib,
pkgs,
...
3 months ago
}:
let
cfg = config.hardware.graphics;
in
{
options = {
hardware.graphics = {
required = lib.mkEnableOption "checks enforcing that at least one graphic driver is installed";
amd.enable = lib.mkEnableOption "AMD graphic drivers";
intel.enable = lib.mkEnableOption "Intel graphic drivers";
};
};
config = lib.mkMerge [
{
assertions = [
{
assertion = cfg.required -> cfg.amd.enable || cfg.intel.enable;
message = "'hardware.graphics.required' not fullfilled by any of 'hardware.graphics.*.enable'";
}
];
}
3 months ago
(
# TODO replace with drivers
lib.mkIf cfg.amd.enable {
assertions = lib.singleton {
assertion = !cfg.amd.enable;
message = "graphics module missing support for AMD drivers";
};
}
3 months ago
)
(lib.mkIf cfg.intel.enable {
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver
intel-media-sdk
libvdpau-va-gl
];
extraPackages32 = with pkgs.pkgsi686Linux; [
# limited set for Steam & co.
intel-media-driver
];
};
})
3 months ago
];
}