From 2f91a0d03939da4726c65c68b0f68b481e4cae31 Mon Sep 17 00:00:00 2001 From: 514fpv Date: Tue, 9 Jan 2024 15:02:40 +0800 Subject: [PATCH] feat(gui): add arc toggle specialisation --- global/gui/default.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/global/gui/default.nix b/global/gui/default.nix index 09c1595f..9d44a37d 100644 --- a/global/gui/default.nix +++ b/global/gui/default.nix @@ -20,6 +20,11 @@ in { type = with types; enum [ "intel" "amdgpu" "nvidia" "prime" ]; description = "type of graphics acceleration used"; }; + arc = mkOption { + type = with types; nullOr str; + default = null; + description = "intel arc PCI ID if installed, enables toggling the arc before boot"; + }; }; config = mkIf cfg.enable { @@ -66,9 +71,21 @@ in { }; }; + specialisation.withArc = mkIf (cfg.arc != null) { + configuration = { + global.gui.arc = mkForce null; + }; + }; + boot.initrd.kernelModules = optional amdgpu "amdgpu" ++ - optional intel "i915"; + optional intel "i915" ++ + optional (cfg.arc != null) "vfio-pci"; + + boot.extraModprobeConfig = mkIf (cfg.arc != null) '' + softdep drm pre: vfio-pci + options vfio-pci ids=${cfg.arc} + ''; boot.kernelParams = optional intel "i915.fastboot=1"; };