1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

poweralertd: fix regression

This fixes a regression introduced in
8d7e352a4b. That commit made the false
assumption that utils would have propagated from Nixpkgs to Home
Manager. This commit copies in `escapeSystemdExecArgs` to fix the
immediate issue, perhaps we can pull this in some other way later down
the line.
This commit is contained in:
Ben Brown 2024-09-20 23:29:26 +01:00 committed by Robert Helgesson
parent dfe4d334b1
commit 51e1d69f7a
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED

View file

@ -2,8 +2,22 @@
with lib;
let cfg = config.services.poweralertd;
let
inherit (lib.strings) toJSON;
cfg = config.services.poweralertd;
escapeSystemdExecArg = arg:
let
s = if isPath arg then
"${arg}"
else if isString arg then
arg
else if isInt arg || isFloat arg || isDerivation arg then
toString arg
else
throw
"escapeSystemdExecArg only allows strings, paths, numbers and derivations";
in replaceStrings [ "%" "$" ] [ "%%" "$$" ] (toJSON s);
escapeSystemdExecArgs = concatMapStringsSep " " escapeSystemdExecArg;
in {
meta.maintainers = [ maintainers.thibautmarty ];
@ -39,7 +53,7 @@ in {
Service = {
Type = "simple";
ExecStart = "${pkgs.poweralertd}/bin/poweralertd ${
utils.escapeSystemdExecArgs cfg.extraArgs
escapeSystemdExecArgs cfg.extraArgs
}";
Restart = "always";
};