diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index a1bbca6b..27f6ec6a 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -3,8 +3,9 @@ , ... }: { imports = [ - ./plymouth.nix ./bluetooth.nix + ./opengl.nix + ./plymouth.nix ]; config = { networking.hostName = hostname; diff --git a/modules/nixos/opengl.nix b/modules/nixos/opengl.nix new file mode 100644 index 00000000..0fc69508 --- /dev/null +++ b/modules/nixos/opengl.nix @@ -0,0 +1,67 @@ +# OpenGL and hardware acceleration +{ config +, lib +, pkgs +, ... +}: { + options = { + nixosConfig.hardware.opengl = { + enable = lib.options.mkOption { + default = false; + defaultText = "Enables OpenGL"; + description = "Enable OpenGL hardware accelleration"; + type = lib.types.bool; + }; + intel = lib.options.mkOption { + default = false; + defaultText = "Enables Intel OpenGL"; + description = "Enable Intel packages for OpenGL and Vulkan hardware accelleration"; + type = lib.types.bool; + }; + amd = lib.options.mkOption { + default = false; + defaultText = "Enables Amd OpenGL"; + description = "Enable Amd packages for OpenGL and Vulkan hardware accelleration"; + type = lib.types.bool; + }; + }; + }; + config = + let + cfg = config.nixosConfig.hardware.opengl; + in + lib.mkIf cfg.enable { + hardware.opengl = { + enable = true; + + driSupport = true; + driSupport32Bit = true; + + extraPackages = with pkgs; [ + libvdpau + vaapiVdpau + # Vulkan + vulkan-validation-layers + vulkan-extension-layer + ] ++ lib.lists.optionals cfg.intel [ + intel-media-driver + intel-compute-runtime + # Intel vaapi drivers + vaapiIntel + ] ++ lib.lists.optionals cfg.amd [ + rocm-opencl-icd + rocm-opencl-runtime + # Vulkan + amdvlk + ]; + + extraPackages32 = with pkgs; [ + ] ++ lib.lists.optionals cfg.amd [ + driversi686Linux.amdvlk + ] ++ lib.lists.optionals cfg.intel [ + pkgsi686Linux.vaapiIntel + ]; + }; + + }; +} diff --git a/systems/burkstaller/default.nix b/systems/burkstaller/default.nix index ae345993..46e2a9fd 100644 --- a/systems/burkstaller/default.nix +++ b/systems/burkstaller/default.nix @@ -45,7 +45,13 @@ }; nixosConfig = { boot.plymouth.enable = false; - hardware.bluetooth.enable = true; + hardware = { + bluetooth.enable = true; + opengl = { + enable = true; + intel = true; + }; + }; desktop.sway.enable = true; };