* Allow Upstart jobs to declare extra configuration for Apache.
Did this for Nagios. Soon we can rename upstart-jobs to services/plugins/whatever (i.e. an Upstart job will just be one kind of configuration item that a plugin can declare). svn path=/nixos/trunk/; revision=9778
This commit is contained in:
parent
1089c1f7fa
commit
e7e685e4ce
|
@ -874,6 +874,7 @@
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# !!! this is a mis-nomer, should be "extraConfig" or something.
|
||||||
extraDirectories = mkOption {
|
extraDirectories = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
example = "
|
example = "
|
||||||
|
@ -1216,6 +1217,23 @@
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableWebInterface = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = "
|
||||||
|
Whether to enable the Nagios web interface. You should also
|
||||||
|
enable Apache (<option>services.httpd.enable</option>).
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
|
urlPath = mkOption {
|
||||||
|
default = "/nagios";
|
||||||
|
description = "
|
||||||
|
The URL path under which the Nagios web interface appears.
|
||||||
|
That is, you can access the Nagios web interface through
|
||||||
|
<literal>http://<replaceable>server</replaceable>/<replaceable>urlPath</replaceable></literal>.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,6 @@ let
|
||||||
(config.services.mingetty.ttys)
|
(config.services.mingetty.ttys)
|
||||||
++ [10] /* !!! sync with syslog.conf */ ;
|
++ [10] /* !!! sync with syslog.conf */ ;
|
||||||
|
|
||||||
in
|
|
||||||
|
|
||||||
import ../upstart-jobs/gather.nix {
|
|
||||||
inherit (pkgs) runCommand;
|
|
||||||
|
|
||||||
jobs = map makeJob [
|
jobs = map makeJob [
|
||||||
# Syslogd.
|
# Syslogd.
|
||||||
|
@ -171,6 +167,8 @@ import ../upstart-jobs/gather.nix {
|
||||||
(import ../upstart-jobs/httpd.nix {
|
(import ../upstart-jobs/httpd.nix {
|
||||||
inherit config pkgs;
|
inherit config pkgs;
|
||||||
inherit (pkgs) glibc;
|
inherit (pkgs) glibc;
|
||||||
|
extraConfig = pkgs.lib.concatStringsSep "\n"
|
||||||
|
(map (job: job.extraHttpdConfig) jobs);
|
||||||
})
|
})
|
||||||
|
|
||||||
# Samba service.
|
# Samba service.
|
||||||
|
@ -203,7 +201,6 @@ import ../upstart-jobs/gather.nix {
|
||||||
inherit config pkgs;
|
inherit config pkgs;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
# ALSA sound support.
|
# ALSA sound support.
|
||||||
++ optional config.sound.enable
|
++ optional config.sound.enable
|
||||||
(import ../upstart-jobs/alsa.nix {
|
(import ../upstart-jobs/alsa.nix {
|
||||||
|
@ -286,4 +283,8 @@ import ../upstart-jobs/gather.nix {
|
||||||
# For the built-in logd job.
|
# For the built-in logd job.
|
||||||
++ [(makeJob { jobDrv = pkgs.upstart; })];
|
++ [(makeJob { jobDrv = pkgs.upstart; })];
|
||||||
|
|
||||||
|
|
||||||
|
in import ../upstart-jobs/gather.nix {
|
||||||
|
inherit (pkgs) runCommand;
|
||||||
|
inherit jobs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{config, pkgs, glibc}:
|
{config, pkgs, glibc, extraConfig}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ let
|
||||||
stateDir = cfg.stateDir;
|
stateDir = cfg.stateDir;
|
||||||
enableSSL = false;
|
enableSSL = false;
|
||||||
noUserDir = cfg.noUserDir;
|
noUserDir = cfg.noUserDir;
|
||||||
extraDirectories = cfg.extraDirectories;
|
extraDirectories = cfg.extraDirectories + extraConfig;
|
||||||
|
|
||||||
startingDependency = if config.services.gw6c.enable then "gw6c" else "network-interfaces";
|
startingDependency = if config.services.gw6c.enable then "gw6c" else "network-interfaces";
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
# Allow jobs to declare extra files that should be added to /etc.
|
# Allow jobs to declare extra files that should be added to /etc.
|
||||||
extraEtc = if job ? extraEtc then job.extraEtc else [];
|
extraEtc = if job ? extraEtc then job.extraEtc else [];
|
||||||
|
|
||||||
|
# Allow jobs to declare extra configuration for Apache (e.g. Nagios
|
||||||
|
# declaring its web interface).
|
||||||
|
extraHttpdConfig = if job ? extraHttpdConfig then job.extraHttpdConfig else "";
|
||||||
|
|
||||||
# Allow jobs to declare user accounts that should be created.
|
# Allow jobs to declare user accounts that should be created.
|
||||||
users = if job ? users then job.users else [];
|
users = if job ? users then job.users else [];
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,37 @@ let
|
||||||
|
|
||||||
";
|
";
|
||||||
|
|
||||||
|
# Plain configuration for the Nagios web-interface with no
|
||||||
|
# authentication.
|
||||||
|
nagiosCGICfgFile = pkgs.writeText "nagios.cgi.conf" "
|
||||||
|
main_config_file=${nagiosCfgFile}
|
||||||
|
use_authentication=0
|
||||||
|
url_html_path=/nagios
|
||||||
|
";
|
||||||
|
|
||||||
|
urlPath = config.services.nagios.urlPath;
|
||||||
|
|
||||||
|
extraHttpdConfig = "
|
||||||
|
ScriptAlias ${urlPath}/cgi-bin ${pkgs.nagios}/sbin
|
||||||
|
|
||||||
|
<Directory \"${pkgs.nagios}/sbin\">
|
||||||
|
Options ExecCGI
|
||||||
|
AllowOverride None
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
SetEnv NAGIOS_CGI_CONFIG ${nagiosCGICfgFile}
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
Alias ${urlPath} ${pkgs.nagios}/share
|
||||||
|
|
||||||
|
<Directory \"${pkgs.nagios}/share\">
|
||||||
|
Options None
|
||||||
|
AllowOverride None
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
</Directory>
|
||||||
|
";
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -68,6 +99,9 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
extraHttpdConfig =
|
||||||
|
if config.services.nagios.enableWebInterface then extraHttpdConfig else "";
|
||||||
|
|
||||||
# Run `nagios -v' to check the validity of the configuration file so
|
# Run `nagios -v' to check the validity of the configuration file so
|
||||||
# that a nixos-rebuild fails *before* we kill the running Nagios
|
# that a nixos-rebuild fails *before* we kill the running Nagios
|
||||||
# daemon.
|
# daemon.
|
||||||
|
|
Loading…
Reference in New Issue