nix-config-v2/modules/graphics/default.nix
2024-12-12 20:41:58 -05:00

43 lines
887 B
Nix

{
pkgs,
lib,
config,
...
}: {
nixosModules.gpuHardware = {gpuVendor ? null, ...}: {
hardware.opengl = {
# Always enable OpenGL support
enable = true;
# Dynamically select packages based on GPU vendor
extraPackages = with pkgs; (
# Base packages that are always included
[
mesa
libvdpau-va-gl
libva
libva-utils
]
# Vendor-specific packages
++ (
if gpuVendor == "intel"
then [
intel-vaapi-driver
intel-media-driver
]
else if gpuVendor == "amd"
then [
rocm-opencl-icd
]
else if gpuVendor == "nvidia"
then [
# Add Nvidia-specific packages if needed
nvidia-vaapi-driver
]
else []
)
);
};
};
}