Skip to content

Commit

Permalink
Merge pull request #54 from joshuachp/feat-opengl
Browse files Browse the repository at this point in the history
feat(opengl): add module to configure opengl
  • Loading branch information
joshuachp authored Aug 9, 2023
2 parents 48e35ae + bb99a10 commit 781065b
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
3 changes: 2 additions & 1 deletion modules/nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
, ...
}: {
imports = [
./plymouth.nix
./bluetooth.nix
./opengl.nix
./plymouth.nix
];
config = {
networking.hostName = hostname;
Expand Down
67 changes: 67 additions & 0 deletions modules/nixos/opengl.nix
Original file line number Diff line number Diff line change
@@ -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
];
};

};
}
8 changes: 7 additions & 1 deletion systems/burkstaller/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down

0 comments on commit 781065b

Please sign in to comment.