assertions

This commit is contained in:
mjallen18
2026-03-19 16:17:20 -05:00
parent dd04320fe7
commit d229cdbf6a
43 changed files with 1190 additions and 997 deletions

View File

@@ -21,6 +21,17 @@ in
};
config = mkIf cfg.enable {
assertions = [
{
assertion = cfg.battery != "";
message = "mjallen.hardware.battery.battery must be set to the sysfs path of the battery charge limit file (e.g. \"/sys/class/power_supply/BAT0/charge_control_end_threshold\").";
}
{
assertion = cfg.chargeLimit > 0 && cfg.chargeLimit <= 100;
message = "mjallen.hardware.battery.chargeLimit must be between 1 and 100 (got ${toString cfg.chargeLimit}).";
}
];
systemd = {
services = {
set-charge-limit = {