poweralertd: Enable passing CLI args to the daemon

This commit is contained in:
Ben Brown 2024-09-20 08:44:52 +01:00 committed by GitHub
parent 6b1912380e
commit 8d7e352a4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,8 +7,18 @@ let cfg = config.services.poweralertd;
in {
meta.maintainers = [ maintainers.thibautmarty ];
options.services.poweralertd.enable =
mkEnableOption "the Upower-powered power alertd";
options.services.poweralertd = {
enable = mkEnableOption "the Upower-powered power alertd";
extraArgs = mkOption {
type = with types; listOf str;
default = [ ];
example = [ "-s" "-S" ];
description = ''
Extra command line arguments to pass to poweralertd.
'';
};
};
config = mkIf cfg.enable {
assertions = [
@ -28,7 +38,9 @@ in {
Service = {
Type = "simple";
ExecStart = "${pkgs.poweralertd}/bin/poweralertd";
ExecStart = "${pkgs.poweralertd}/bin/poweralertd ${
utils.escapeSystemdExecArgs cfg.extraArgs
}";
Restart = "always";
};
};