nixos/smokeping: Format smokeping source code

This commit is contained in:
Bruno Adelé 2023-04-19 20:05:27 +02:00
parent 8ef336e870
commit 7af8ace239
No known key found for this signature in database
GPG Key ID: C5BDE70F86D3EEDA

View File

@ -8,36 +8,36 @@ let
smokepingPidDir = "/run";
configFile =
if cfg.config == null
then
''
*** General ***
cgiurl = ${cfg.cgiUrl}
contact = ${cfg.ownerEmail}
datadir = ${smokepingHome}/data
imgcache = ${smokepingHome}/cache
imgurl = ${cfg.imgUrl}
linkstyle = ${cfg.linkStyle}
${lib.optionalString (cfg.mailHost != "") "mailhost = ${cfg.mailHost}"}
owner = ${cfg.owner}
pagedir = ${smokepingHome}/cache
piddir = ${smokepingPidDir}
${lib.optionalString (cfg.sendmail != null) "sendmail = ${cfg.sendmail}"}
smokemail = ${cfg.smokeMailTemplate}
*** Presentation ***
template = ${cfg.presentationTemplate}
${cfg.presentationConfig}
*** Alerts ***
${cfg.alertConfig}
*** Database ***
${cfg.databaseConfig}
*** Probes ***
${cfg.probeConfig}
*** Targets ***
${cfg.targetConfig}
${cfg.extraConfig}
''
else
cfg.config;
then
''
*** General ***
cgiurl = ${cfg.cgiUrl}
contact = ${cfg.ownerEmail}
datadir = ${smokepingHome}/data
imgcache = ${smokepingHome}/cache
imgurl = ${cfg.imgUrl}
linkstyle = ${cfg.linkStyle}
${lib.optionalString (cfg.mailHost != "") "mailhost = ${cfg.mailHost}"}
owner = ${cfg.owner}
pagedir = ${smokepingHome}/cache
piddir = ${smokepingPidDir}
${lib.optionalString (cfg.sendmail != null) "sendmail = ${cfg.sendmail}"}
smokemail = ${cfg.smokeMailTemplate}
*** Presentation ***
template = ${cfg.presentationTemplate}
${cfg.presentationConfig}
*** Alerts ***
${cfg.alertConfig}
*** Database ***
${cfg.databaseConfig}
*** Probes ***
${cfg.probeConfig}
*** Targets ***
${cfg.targetConfig}
${cfg.extraConfig}
''
else
cfg.config;
configPath = pkgs.writeText "smokeping.conf" configFile;
cgiHome = pkgs.writeScript "smokeping.fcgi" ''
@ -141,7 +141,7 @@ in
'';
};
linkStyle = mkOption {
type = types.enum ["original" "absolute" "relative"];
type = types.enum [ "original" "absolute" "relative" ];
default = "relative";
example = "absolute";
description = lib.mdDoc "DNS name for the urls generated in the cgi.";
@ -301,7 +301,8 @@ in
];
security.wrappers = {
fping =
{ setuid = true;
{
setuid = true;
owner = "root";
group = "root";
source = "${pkgs.fping}/bin/fping";
@ -347,8 +348,8 @@ in
'';
};
systemd.services.thttpd = mkIf cfg.webService {
requiredBy = [ "multi-user.target"];
requires = [ "smokeping.service"];
requiredBy = [ "multi-user.target" ];
requires = [ "smokeping.service" ];
path = with pkgs; [ bash rrdtool smokeping thttpd ];
serviceConfig = {
Restart = "always";