mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-09 03:56:09 +01:00
Merge pull request #1414 from moduon/nvidia-battery-saver
Some checks are pending
Test / tests (push) Waiting to run
Some checks are pending
Test / tests (push) Waiting to run
feat(nvidia-prime): automatic battery-saver specialisation
This commit is contained in:
commit
e8f38b2c19
1 changed files with 29 additions and 5 deletions
|
|
@ -3,11 +3,35 @@
|
|||
{
|
||||
imports = [ ./. ];
|
||||
|
||||
hardware.nvidia.prime = {
|
||||
offload = {
|
||||
enable = lib.mkOverride 990 true;
|
||||
enableOffloadCmd = lib.mkIf config.hardware.nvidia.prime.offload.enable true; # Provides `nvidia-offload` command.
|
||||
options = {
|
||||
hardware.nvidia.primeBatterySaverSpecialisation = lib.mkEnableOption "configure a specialisation which turns on NVIDIA Prime battery saver";
|
||||
};
|
||||
|
||||
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
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue