added prime.nix to nvidia module

This commit is contained in:
Sakooooo 2023-08-13 19:36:46 +03:00
parent ecd1d29d45
commit 0ca50771ee
Signed by: sako
GPG key ID: 3FD715D87D7725E0
2 changed files with 7 additions and 25 deletions

View file

@ -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;
};
};
};
}

View file

@ -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";