2024-12-06 16:46:10 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
namespace,
|
|
|
|
...
|
|
|
|
}:
|
2024-02-29 14:53:34 +00:00
|
|
|
let
|
2024-12-06 16:46:10 +00:00
|
|
|
cfg = config.${namespace}.services.apcupsd;
|
2024-02-29 14:53:34 +00:00
|
|
|
in
|
|
|
|
{
|
2024-05-07 22:02:59 +00:00
|
|
|
options = {
|
2024-12-06 16:46:10 +00:00
|
|
|
${namespace}.services.apcupsd = {
|
2024-08-02 21:55:48 +00:00
|
|
|
enable = lib.mkEnableOption "Enables apcupsd";
|
2024-05-21 13:22:03 +00:00
|
|
|
configText = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "The configuration to pass to apcupsd.";
|
|
|
|
};
|
|
|
|
};
|
2024-05-07 22:02:59 +00:00
|
|
|
};
|
2024-02-29 14:53:34 +00:00
|
|
|
|
2024-08-02 21:55:48 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-05-07 22:02:59 +00:00
|
|
|
services.apcupsd = {
|
|
|
|
enable = true;
|
2024-05-21 13:22:03 +00:00
|
|
|
configText = cfg.configText;
|
2024-05-07 22:02:59 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|