Skip to content

Commit e8f916c

Browse files
committed
Move battery options to non-asus specific folder
1 parent 753176b commit e8f916c

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

asus/ally/rc71l/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
../../../common/gpu/amd
77
../../../common/pc/laptop
88
../../../common/pc/laptop/ssd
9-
../../battery.nix
9+
../../../common/pc/laptop/battery.nix
1010
];
1111

1212
# 6.5 adds many fixes and improvements for the Ally

asus/rog-strix/g513im/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
../../../common/gpu/nvidia/prime.nix
77
../../../common/pc/laptop
88
../../../common/pc/ssd
9-
../../battery.nix
9+
../../../common/pc/laptop/battery.nix
1010
];
1111

1212
hardware.nvidia.prime = {

asus/rog-strix/g733qs/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
../../../common/gpu/nvidia/prime.nix
66
../../../common/pc/laptop
77
../../../common/pc/ssd
8-
../../battery.nix
8+
../../../common/pc/laptop/battery.nix
99
];
1010

1111
# fixing audio by overriding pins as suggested in

asus/battery.nix renamed to common/pc/laptop/battery.nix

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
{ config, pkgs, lib, ... }:
1+
{
2+
config,
3+
pkgs,
4+
lib,
5+
...
6+
}:
27
let
38
p = pkgs.writeScriptBin "charge-upto" ''
49
echo ''${0:-100} > /sys/class/power_supply/BAT?/charge_control_end_threshold
@@ -7,7 +12,7 @@ let
712
in
813

914
{
10-
options.hardware.asus.battery = {
15+
options.hardware.battery = {
1116
chargeUpto = lib.mkOption {
1217
description = "Maximum level of charge for your battery, as a percentage.";
1318
default = 100;
@@ -19,11 +24,33 @@ in
1924
type = lib.types.bool;
2025
};
2126
};
27+
imports = (
28+
map
29+
(
30+
option:
31+
lib.mkRemovedOptionModule [
32+
"hardware"
33+
"asus"
34+
"battery"
35+
option
36+
] "The hardware.asus.battery.* options were removed in favor of `hardware.battery.*`."
37+
)
38+
[
39+
"chargeUpto"
40+
"enableChargeUptoScript"
41+
]
42+
);
2243
config = {
2344
environment.systemPackages = lib.mkIf cfg.enableChargeUptoScript [ p ];
2445
systemd.services.battery-charge-threshold = {
25-
wantedBy = [ "local-fs.target" "suspend.target" ];
26-
after = [ "local-fs.target" "suspend.target" ];
46+
wantedBy = [
47+
"local-fs.target"
48+
"suspend.target"
49+
];
50+
after = [
51+
"local-fs.target"
52+
"suspend.target"
53+
];
2754
description = "Set the battery charge threshold to ${toString cfg.chargeUpto}%";
2855
startLimitBurst = 5;
2956
startLimitIntervalSec = 1;

0 commit comments

Comments
 (0)