feat(aspen/system): Make battery index configurable
My new laptop has the battery at index 1, not index 0 Change-Id: I64fa16e7f0eecf6b623361645d73b1176e1e5d48 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11311 Tested-by: BuildkiteCI Autosubmit: aspen <root@gws.fyi> Reviewed-by: aspen <root@gws.fyi>
This commit is contained in:
		
							parent
							
								
									e0871efeaf
								
							
						
					
					
						commit
						87d5dd6371
					
				
					 2 changed files with 7 additions and 7 deletions
				
			
		|  | @ -23,7 +23,7 @@ in | ||||||
|   system.machine = { |   system.machine = { | ||||||
|     wirelessInterface = "wlp4s0"; |     wirelessInterface = "wlp4s0"; | ||||||
|     i3FontSize = 9; |     i3FontSize = 9; | ||||||
|     battery = false; |     battery = null; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   home.packages = with pkgs; [ |   home.packages = with pkgs; [ | ||||||
|  |  | ||||||
|  | @ -39,9 +39,9 @@ in | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|       battery = mkOption { |       battery = mkOption { | ||||||
|         description = "Does this system have a battery?"; |         description = "Battery index for this system's battery"; | ||||||
|         default = true; |         default = 0; | ||||||
|         type = types.bool; |         type = types.nullOr types.int; | ||||||
|       }; |       }; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
|  | @ -242,8 +242,8 @@ in | ||||||
|                   order += "wireless ${config.system.machine.wirelessInterface}" |                   order += "wireless ${config.system.machine.wirelessInterface}" | ||||||
|                   # order += "ethernet enp3s0f0" |                   # order += "ethernet enp3s0f0" | ||||||
|                   order += "cpu_usage" |                   order += "cpu_usage" | ||||||
|                   ${lib.optionalString (config.system.machine.battery) '' |                   ${lib.optionalString (!isNull config.system.machine.battery) '' | ||||||
|                       order += "battery 0" |                     order += "battery ${toString config.system.machine.battery}" | ||||||
|                   ''} |                   ''} | ||||||
|                   # order += "volume master" |                   # order += "volume master" | ||||||
|                   order += "time" |                   order += "time" | ||||||
|  | @ -263,7 +263,7 @@ in | ||||||
|                       format_down = "E: -" |                       format_down = "E: -" | ||||||
|                   } |                   } | ||||||
| 
 | 
 | ||||||
|                   battery 0 { |                   battery ${toString config.system.machine.battery} { | ||||||
|                       format = "%status %percentage" |                       format = "%status %percentage" | ||||||
|                       path = "/sys/class/power_supply/BAT%d/uevent" |                       path = "/sys/class/power_supply/BAT%d/uevent" | ||||||
|                       low_threshold = 10 |                       low_threshold = 10 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue