diff --git a/machines/nunotaba/configuration.nix b/machines/nunotaba/configuration.nix index 07c28f3..f046ac8 100644 --- a/machines/nunotaba/configuration.nix +++ b/machines/nunotaba/configuration.nix @@ -5,13 +5,13 @@ [ ./hardware-configuration.nix ../../modules/cpu/intel.nix - ../../modules/gpu/intel.nix ../../modules ../../profiles/dev.nix ../../users/simon ]; sbruder = { + gpu.intel.enable = true; gui.enable = true; libvirt.enable = true; restic.enable = true; diff --git a/machines/sayuri/configuration.nix b/machines/sayuri/configuration.nix index e8878e9..3d1b00d 100644 --- a/machines/sayuri/configuration.nix +++ b/machines/sayuri/configuration.nix @@ -5,13 +5,13 @@ [ ./hardware-configuration.nix ../../modules/cpu/intel.nix - ../../modules/gpu/amd.nix ../../modules ../../profiles/dev.nix ../../users/simon ]; sbruder = { + gpu.amd.enable = true; gui.enable = true; libvirt.enable = true; restic.enable = true; diff --git a/modules/default.nix b/modules/default.nix index 5dff8ff..df4734e 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -14,6 +14,7 @@ ./cups.nix ./docker.nix ./fonts.nix + ./gpu ./grub.nix ./libvirt.nix ./locales.nix diff --git a/modules/gpu/amd.nix b/modules/gpu/amd.nix index 6917340..b98e159 100644 --- a/modules/gpu/amd.nix +++ b/modules/gpu/amd.nix @@ -1,26 +1,32 @@ -{ pkgs, ... }: - +{ config, lib, pkgs, ... }: +let + cfg = config.sbruder.gpu.amd; +in { - hardware.opengl.extraPackages = with pkgs; [ - amdvlk - rocm-opencl-icd - ]; + options.sbruder.gpu.amd.enable = lib.mkEnableOption "amd gpu configuration"; - environment.systemPackages = with pkgs; [ - clinfo - radeontop - rocm-smi - ]; + config = lib.mkIf cfg.enable { + hardware.opengl.extraPackages = with pkgs; [ + amdvlk + rocm-opencl-icd + ]; - # force RGB otput for HDMI (otherwise the default is YCbCr) - # see https://gitlab.freedesktop.org/drm/amd/-/issues/476 - #boot.kernelPatches = [ - # { - # name = "force-rgb"; - # patch = pkgs.fetchurl { - # url = "https://gitlab.freedesktop.org/drm/amd/uploads/99b3664a49ec759075bde5c454e1d7c2/0001-force-rgb.patch"; - # sha256 = "03dhnlxx9vlj1x8izh3c3j4r9s75q47nx8kf6mbdxqfy3cj96mjm"; - # }; - # } - #]; + environment.systemPackages = with pkgs; [ + clinfo + radeontop + rocm-smi + ]; + + # force RGB otput for HDMI (otherwise the default is YCbCr) + # see https://gitlab.freedesktop.org/drm/amd/-/issues/476 + #boot.kernelPatches = [ + # { + # name = "force-rgb"; + # patch = pkgs.fetchurl { + # url = "https://gitlab.freedesktop.org/drm/amd/uploads/99b3664a49ec759075bde5c454e1d7c2/0001-force-rgb.patch"; + # sha256 = "03dhnlxx9vlj1x8izh3c3j4r9s75q47nx8kf6mbdxqfy3cj96mjm"; + # }; + # } + #]; + }; } diff --git a/modules/gpu/default.nix b/modules/gpu/default.nix new file mode 100644 index 0000000..68eb19d --- /dev/null +++ b/modules/gpu/default.nix @@ -0,0 +1,7 @@ +{ lib, ... }: +{ + imports = [ + ./amd.nix + ./intel.nix + ]; +} diff --git a/modules/gpu/intel.nix b/modules/gpu/intel.nix index 3fea0b2..103a6ed 100644 --- a/modules/gpu/intel.nix +++ b/modules/gpu/intel.nix @@ -1,8 +1,14 @@ -{ pkgs, ... }: - +{ config, lib, pkgs, ... }: +let + cfg = config.sbruder.gpu.intel; +in { - hardware.opengl.extraPackages = with pkgs; [ - beignet - vaapiIntel - ]; + options.sbruder.gpu.intel.enable = lib.mkEnableOption "intel gpu configuration"; + + config = lib.mkIf cfg.enable { + hardware.opengl.extraPackages = with pkgs; [ + beignet + vaapiIntel + ]; + }; }