1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-16 16:19:44 +01: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; 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 { in {
meta.maintainers = [ maintainers.thibautmarty ]; meta.maintainers = [ maintainers.thibautmarty ];
@ -39,7 +53,7 @@ in {
Service = { Service = {
Type = "simple"; Type = "simple";
ExecStart = "${pkgs.poweralertd}/bin/poweralertd ${ ExecStart = "${pkgs.poweralertd}/bin/poweralertd ${
utils.escapeSystemdExecArgs cfg.extraArgs escapeSystemdExecArgs cfg.extraArgs
}"; }";
Restart = "always"; Restart = "always";
}; };