2024-05-15 00:19:56 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.drivers.nvidia-prime;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.drivers.nvidia-prime = {
|
|
|
|
enable = mkEnableOption "Enable Nvidia Prime Hybrid GPU Offload";
|
|
|
|
intelBusID = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "PCI:1:0:0";
|
|
|
|
};
|
|
|
|
nvidiaBusID = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "PCI:0:2:0";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
hardware.nvidia = {
|
|
|
|
prime = {
|
|
|
|
offload = {
|
2024-05-15 01:36:40 +02:00
|
|
|
enable = true;
|
|
|
|
enableOffloadCmd = true;
|
|
|
|
};
|
2024-05-15 00:19:56 +02:00
|
|
|
# Make sure to use the correct Bus ID values for your system!
|
|
|
|
intelBusId = "${cfg.intelBusID}";
|
|
|
|
nvidiaBusId = "${cfg.nvidiaBusID}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|