nix-config/modules/nixos/hardware/upower/default.nix
Bruno BELANYI c856933803 nixos: create 'modules/nixos' folder
Let's consolidate all modules under one path, so that NixOS,
home-manager, and nix-darwin (if I ever end up using it down the line)
would go under the same folder.
2023-11-11 18:11:52 +00:00

45 lines
918 B
Nix

{ config, lib, ... }:
let
cfg = config.my.hardware.upower;
in
{
options.my.hardware.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;
};
};
}