modules: add upower
This commit is contained in:
parent
abdba0a223
commit
853bb7a0ce
|
@ -12,6 +12,7 @@
|
|||
./networking.nix
|
||||
./nix.nix
|
||||
./packages.nix
|
||||
./upower.nix
|
||||
./users.nix
|
||||
];
|
||||
}
|
||||
|
|
44
modules/upower.nix
Normal file
44
modules/upower.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.modules.upower;
|
||||
in
|
||||
{
|
||||
options.my.modules.upower = with lib; {
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue