diff --git a/modules/nixos/facter.nix b/modules/nixos/facter.nix index a7bd8ac..78dc0e5 100644 --- a/modules/nixos/facter.nix +++ b/modules/nixos/facter.nix @@ -9,7 +9,7 @@ ./disk.nix ./keyboard.nix ./firmware.nix - ./graphics.nix + ./graphics ./networking ./system.nix ./virtualisation.nix diff --git a/modules/nixos/graphics/amd.nix b/modules/nixos/graphics/amd.nix new file mode 100644 index 0000000..81dba29 --- /dev/null +++ b/modules/nixos/graphics/amd.nix @@ -0,0 +1,17 @@ +{ lib, config, ... }: +let + facterLib = import ../../../lib/lib.nix lib; + cfg = config.facter.detected.graphics.amd; +in +{ + options.facter.detected.graphics = { + amd.enable = lib.mkEnableOption "Enable the AMD Graphics module" // { + default = builtins.elem "amdgpu" ( + facterLib.collectDrivers (config.facter.report.hardware.graphics_card or [ ]) + ); + }; + }; + config = lib.mkIf cfg.enable { + services.xserver.videoDrivers = [ "amdgpu" ]; + }; +} diff --git a/modules/nixos/graphics.nix b/modules/nixos/graphics/default.nix similarity index 93% rename from modules/nixos/graphics.nix rename to modules/nixos/graphics/default.nix index 8acc8b6..b164b70 100644 --- a/modules/nixos/graphics.nix +++ b/modules/nixos/graphics/default.nix @@ -1,9 +1,12 @@ { lib, config, ... }: let - facterLib = import ../../lib/lib.nix lib; + facterLib = import ../../../lib/lib.nix lib; cfg = config.facter.detected.graphics; in { + imports = [ + ./amd.nix + ]; options.facter.detected = { graphics.enable = lib.mkEnableOption "Enable the Graphics module" // { default = builtins.length (config.facter.report.hardware.monitor or [ ]) > 0;