From 5da047a5c92ef17737365bc767b482553a88f0ad Mon Sep 17 00:00:00 2001 From: Ahwx Date: Mon, 24 Mar 2025 09:24:17 +0100 Subject: [PATCH] feat: move `amdgpu`-specific config to its own role, since i now also have nvidia systems --- modules/core/hardware.nix | 15 --------------- roles/amdgpu.nix | 31 +++++++++++++++++++++++++++++++ roles/default.nix | 2 ++ 3 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 roles/amdgpu.nix diff --git a/modules/core/hardware.nix b/modules/core/hardware.nix index c727176..1f1523c 100644 --- a/modules/core/hardware.nix +++ b/modules/core/hardware.nix @@ -1,18 +1,3 @@ { pkgs, ... }: { - hardware = { - graphics = { - enable = true; - }; - enableRedistributableFirmware = true; - opengl = { - extraPackages = with pkgs; [ - amdvlk - ]; - # For 32 bit applications as well - extraPackages32 = with pkgs; [ - driversi686Linux.amdvlk - ]; - }; - }; } diff --git a/roles/amdgpu.nix b/roles/amdgpu.nix new file mode 100644 index 0000000..8d017f1 --- /dev/null +++ b/roles/amdgpu.nix @@ -0,0 +1,31 @@ +{ lib, pkgs, config, ... }: +with lib; +let + cfg = config.liv.amdgpu; +in { + options.liv.amdgpu = { + enable = mkEnableOption "Enable amdgpu drivers"; + }; + + config = mkIf cfg.enable { + hardware = { + graphics = { + enable = true; + }; + enableRedistributableFirmware = true; + opengl = { + extraPackages = with pkgs; [ + amdvlk + ]; + # For 32 bit applications as well + extraPackages32 = with pkgs; [ + driversi686Linux.amdvlk + ]; + }; + }; + + environment.systemPackages = with pkgs; [ + amdvlk + ]; + }; +} diff --git a/roles/default.nix b/roles/default.nix index 48842f5..b89d962 100644 --- a/roles/default.nix +++ b/roles/default.nix @@ -2,6 +2,8 @@ { imports = [(import ./laptop.nix)] + ++ [(import ./amdgpu.nix)] + ++ [(import ./nvidia.nix)] ++ [(import ./desktop.nix)] ++ [(import ./creative.nix)]; }