File tree Expand file tree Collapse file tree 1 file changed +26
-6
lines changed Expand file tree Collapse file tree 1 file changed +26
-6
lines changed Original file line number Diff line number Diff line change 1
1
{ lib , config , ... } :
2
2
3
3
{
4
- imports = [ ./. ] ;
4
+ options = {
5
+ hardware . nvidia . primeBatterySaverSpecialisation = lib . mkEnableOption "Enable the battery saver specialisation for NVIDIA Prime" ;
6
+ } ;
7
+
8
+ config = {
9
+ imports = [ ./. ] ;
10
+
11
+ hardware . nvidia . prime = {
12
+ offload = {
13
+ enable = lib . mkOverride 990 true ;
14
+ enableOffloadCmd = lib . mkIf config . hardware . nvidia . prime . offload . enable true ; # Provides `nvidia-offload` command.
15
+ } ;
16
+ # Hardware should specify the bus ID for intel/nvidia devices
17
+ } ;
5
18
6
- hardware . nvidia . prime = {
7
- offload = {
8
- enable = lib . mkOverride 990 true ;
9
- enableOffloadCmd = lib . mkIf config . hardware . nvidia . prime . offload . enable true ; # Provides `nvidia-offload` command.
19
+ # A specialisation for optimal battery life
20
+ specialisation = lib . optionalAttrs config . hardware . nvidia . primeBatterySaverSpecialisation {
21
+ battery-saver . configuration = {
22
+ system . nixos . tags = [ "battery-saver" ] ;
23
+ imports = [
24
+ # Leave only the integrated GPU enabled
25
+ ./disable.nix
26
+ ] ;
27
+ hardware . nvidia . prime . offload . enable = lib . mkForce false ;
28
+ hardware . nvidia . powerManagement . enable = lib . mkForce false ;
29
+ hardware . nvidia . powerManagement . finegrained = lib . mkForce false ;
30
+ } ;
10
31
} ;
11
- # Hardware should specify the bus ID for intel/nvidia devices
12
32
} ;
13
33
}
You can’t perform that action at this time.
0 commit comments