Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nvidia-prime): automatic battery-saver specialisation #1414

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yajo
Copy link

@yajo yajo commented Mar 13, 2025

This enables a boot option that switches off NVIDIA GPU. Allows for battery saving.

@moduon MT-9339

Description of changes
Things done
  • Tested the changes in your own NixOS Configuration
  • Tested the changes end-to-end by using your fork of nixos-hardware and
    importing it via <nixos-hardware> or Flake input

@yajo yajo marked this pull request as ready for review March 13, 2025 11:53
This enables a boot option that switches off NVIDIA GPU. Allows for battery saving.

@moduon MT-9339
@yajo yajo force-pushed the nvidia-battery-saver branch from 5808a05 to a807913 Compare March 13, 2025 12:04
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like here: https://github.com/NixOS/nixos-hardware/pull/1413/files#diff-0fd91ddb6f4a0caed91c46e554f84c36da109e5b30a68655b45fab12058ebf7fR21

Would you prefer if this were an assertion?

FWIW this comment was already here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, would probably be nice if we asserted this so that it isn't forgotten.

@yajo
Copy link
Author

yajo commented Mar 18, 2025

IMHO this should be ready to merge.

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";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hardware.nvidia.primeBatterySaverSpecialisation = lib.mkEnableOption "Configure a specialisation which turns on NVIDIA Prime battery saver";
hardware.nvidia.primeBatterySaverSpecialisation = lib.mkEnableOption "configure a specialisation which turns on NVIDIA Prime battery saver";

otherwise the generated option will be named with a capital letter in a random position.

Comment on lines +27 to +29
hardware.nvidia.prime.offload.enable = lib.mkForce false;
hardware.nvidia.powerManagement.enable = lib.mkForce false;
hardware.nvidia.powerManagement.finegrained = lib.mkForce false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hardware.nvidia.prime.offload.enable = lib.mkForce false;
hardware.nvidia.powerManagement.enable = lib.mkForce false;
hardware.nvidia.powerManagement.finegrained = lib.mkForce false;
hardware.nvidia = {
prime.offload.enable = lib.mkForce false;
powerManagement = {
enable = lib.mkForce false;
finegrained = lib.mkForce false;
};
};

but only a nit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants