mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-05 17:38:41 +08:00
feat(nvidia-prime): automatic battery-saver specialisation
This enables a boot option that switches off NVIDIA GPU. Allows for battery saving. @moduon MT-9339
This commit is contained in:
committed by
Jairo Llopis
parent
a4bb30a900
commit
33d083f55b
@@ -3,11 +3,35 @@
|
|||||||
{
|
{
|
||||||
imports = [ ./. ];
|
imports = [ ./. ];
|
||||||
|
|
||||||
hardware.nvidia.prime = {
|
options = {
|
||||||
offload = {
|
hardware.nvidia.primeBatterySaverSpecialisation = lib.mkEnableOption "configure a specialisation which turns on NVIDIA Prime battery saver";
|
||||||
enable = lib.mkOverride 990 true;
|
};
|
||||||
enableOffloadCmd = lib.mkIf config.hardware.nvidia.prime.offload.enable true; # Provides `nvidia-offload` command.
|
|
||||||
|
config = {
|
||||||
|
|
||||||
|
hardware.nvidia.prime = {
|
||||||
|
offload = {
|
||||||
|
enable = lib.mkOverride 990 true;
|
||||||
|
enableOffloadCmd = lib.mkIf config.hardware.nvidia.prime.offload.enable true; # Provides `nvidia-offload` command.
|
||||||
|
};
|
||||||
|
# Hardware should specify the bus ID for intel/nvidia devices
|
||||||
|
};
|
||||||
|
|
||||||
|
specialisation = lib.mkIf config.hardware.nvidia.primeBatterySaverSpecialisation {
|
||||||
|
battery-saver.configuration = {
|
||||||
|
system.nixos.tags = ["battery-saver"];
|
||||||
|
imports = [
|
||||||
|
# Leave only the integrated GPU enabled
|
||||||
|
./disable.nix
|
||||||
|
];
|
||||||
|
hardware.nvidia = {
|
||||||
|
prime.offload.enable = lib.mkForce false;
|
||||||
|
powerManagement = {
|
||||||
|
enable = lib.mkForce false;
|
||||||
|
finegrained = lib.mkForce false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
# Hardware should specify the bus ID for intel/nvidia devices
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user