nixos/smokeping: use /etc/smokeping.conf

This allows other services to refer to the generated smokeping config,
which is e.g. necessary to run smokeping with nginx as frontend, rather
than thttpd.
This commit is contained in:
Florian Klink 2023-04-05 00:10:12 +02:00
parent 92dd06ae1d
commit 9de75c8bbe

View file

@ -42,7 +42,7 @@ let
configPath = pkgs.writeText "smokeping.conf" configFile;
cgiHome = pkgs.writeScript "smokeping.fcgi" ''
#!${pkgs.bash}/bin/bash
${cfg.package}/bin/smokeping_cgi ${configPath}
${cfg.package}/bin/smokeping_cgi /etc/smokeping.conf
'';
in
@ -307,6 +307,7 @@ in
source = "${pkgs.fping}/bin/fping";
};
};
environment.etc."smokeping.conf".source = configPath;
environment.systemPackages = [ pkgs.fping ];
users.users.${cfg.user} = {
isNormalUser = false;
@ -327,13 +328,14 @@ in
# Thus, we need to make `smokepingHome` (which is given to `thttpd -d` below) `755`.
homeMode = "755";
};
users.groups.${cfg.user} = {};
users.groups.${cfg.user} = { };
systemd.services.smokeping = {
requiredBy = [ "multi-user.target"];
reloadTriggers = [ configPath ];
requiredBy = [ "multi-user.target" ];
serviceConfig = {
User = cfg.user;
Restart = "on-failure";
ExecStart = "${cfg.package}/bin/smokeping --config=${configPath} --nodaemon";
ExecStart = "${cfg.package}/bin/smokeping --config=/etc/smokeping.conf --nodaemon";
};
preStart = ''
mkdir -m 0755 -p ${smokepingHome}/cache ${smokepingHome}/data