nix-config/modules/nixos/hardware/upower/default.nix

45 lines
918 B
Nix
Raw Normal View History

2021-09-24 01:15:40 +02:00
{ config, lib, ... }:
2021-05-10 17:47:47 +02:00
let
2021-05-29 16:44:34 +02:00
cfg = config.my.hardware.upower;
2021-05-10 17:47:47 +02:00
in
{
2021-05-29 16:44:34 +02:00
options.my.hardware.upower = with lib; {
2021-05-10 17:47:47 +02:00
enable = mkEnableOption "upower configuration";
levels = {
low = mkOption {
type = types.ints.unsigned;
default = 25;
example = 10;
description = "Low percentage";
};
critical = mkOption {
type = types.ints.unsigned;
default = 15;
example = 5;
description = "Critical percentage";
};
action = mkOption {
type = types.ints.unsigned;
default = 5;
example = 3;
description = "Percentage at which point an action must be taken";
};
};
};
config = lib.mkIf cfg.enable {
services.upower = {
enable = true;
percentageLow = cfg.levels.low;
percentageCritical = cfg.levels.critical;
percentageAction = cfg.levels.action;
};
};
}