2023-08-13 20:32:50 +04:00
|
|
|
{
|
|
|
|
outputs,
|
|
|
|
options,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2024-08-01 16:24:09 +04:00
|
|
|
let
|
2023-08-13 20:36:46 +04:00
|
|
|
cfg = config.modules.hardware.nvidia.prime;
|
2023-08-13 20:32:50 +04:00
|
|
|
busIDType = lib.types.strMatching "([[:print:]]+[\:\@][0-9]{1,3}\:[0-9]{1,2}\:[0-9])?";
|
|
|
|
in {
|
|
|
|
options.modules.hardware.nvidia.prime = {
|
2024-08-01 16:24:09 +04:00
|
|
|
enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2023-08-13 20:36:46 +04:00
|
|
|
default = false;
|
|
|
|
};
|
2024-08-01 16:24:09 +04:00
|
|
|
intelBusId = lib.mkOption {
|
2023-08-13 20:32:50 +04:00
|
|
|
type = busIDType;
|
|
|
|
default = "";
|
|
|
|
};
|
2024-08-01 16:24:09 +04:00
|
|
|
nvidiaBusId = lib.mkOption {
|
2023-08-13 20:32:50 +04:00
|
|
|
type = busIDType;
|
|
|
|
default = "";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-08-01 16:24:09 +04:00
|
|
|
config = lib.mkIf cfg.enable {
|
2023-08-13 20:32:50 +04:00
|
|
|
hardware.nvidia = {
|
|
|
|
prime = {
|
|
|
|
offload = {
|
2023-08-13 20:36:46 +04:00
|
|
|
enable = cfg.enable;
|
|
|
|
enableOffloadCmd = cfg.enable;
|
2023-08-13 20:32:50 +04:00
|
|
|
};
|
|
|
|
#intelBusId = "PCI:0:2:0";
|
|
|
|
#nvidiaBusId = "PCI:1:0:0";
|
|
|
|
intelBusId = cfg.intelBusId;
|
|
|
|
nvidiaBusId = cfg.nvidiaBusId;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|