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