mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-07 02:18:47 +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,6 +3,12 @@
|
|||||||
{
|
{
|
||||||
imports = [ ./. ];
|
imports = [ ./. ];
|
||||||
|
|
||||||
|
options = {
|
||||||
|
hardware.nvidia.primeBatterySaverSpecialisation = lib.mkEnableOption "configure a specialisation which turns on NVIDIA Prime battery saver";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
|
||||||
hardware.nvidia.prime = {
|
hardware.nvidia.prime = {
|
||||||
offload = {
|
offload = {
|
||||||
enable = lib.mkOverride 990 true;
|
enable = lib.mkOverride 990 true;
|
||||||
@@ -10,4 +16,22 @@
|
|||||||
};
|
};
|
||||||
# Hardware should specify the bus ID for intel/nvidia devices
|
# 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user