From 0ca50771eeec9f4e8789ba2dca6e2b28028f1be2 Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Sun, 13 Aug 2023 19:36:46 +0300 Subject: [PATCH] added prime.nix to nvidia module --- modules/hardware/nvidia/default.nix | 21 --------------------- modules/hardware/nvidia/prime.nix | 11 +++++++---- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/modules/hardware/nvidia/default.nix b/modules/hardware/nvidia/default.nix index 1c563375..9a13f7e6 100644 --- a/modules/hardware/nvidia/default.nix +++ b/modules/hardware/nvidia/default.nix @@ -15,15 +15,6 @@ in { ]; options.modules.hardware.nvidia = { enable = mkEnableOption false; - prime.enable = mkEnableOption false; - prime.intelBusId = mkOption { - type = busIDType; - default = ""; - }; - prime.nvidiaBusId = mkOption { - type = busIDType; - default = ""; - }; }; config = mkIf cfg.enable { @@ -56,18 +47,6 @@ in { # Package package = config.boot.kernelPackages.nvidiaPackages.stable; - - # TODO(sako) ALSO add these as a cfg option - prime = { - offload = { - enable = cfg.prime; - enableOffloadCmd = cfg.prime; - }; - #intelBusId = "PCI:0:2:0"; - #nvidiaBusId = "PCI:1:0:0"; - intelBusId = cfg.intelBusId; - nvidiaBusId = cfg.nvidiaBusId; - }; }; }; } diff --git a/modules/hardware/nvidia/prime.nix b/modules/hardware/nvidia/prime.nix index 5899e892..eb47491f 100644 --- a/modules/hardware/nvidia/prime.nix +++ b/modules/hardware/nvidia/prime.nix @@ -7,11 +7,14 @@ ... }: with lib; let - cfg = config.modules.hardware.nvidia; + cfg = config.modules.hardware.nvidia.prime; busIDType = lib.types.strMatching "([[:print:]]+[\:\@][0-9]{1,3}\:[0-9]{1,2}\:[0-9])?"; in { options.modules.hardware.nvidia.prime = { - enable = mkEnableOption false; + enable = mkOption { + type = types.bool; + default = false; + }; intelBusId = mkOption { type = busIDType; default = ""; @@ -26,8 +29,8 @@ in { hardware.nvidia = { prime = { offload = { - enable = cfg.prime; - enableOffloadCmd = cfg.prime; + enable = cfg.enable; + enableOffloadCmd = cfg.enable; }; #intelBusId = "PCI:0:2:0"; #nvidiaBusId = "PCI:1:0:0";