nixpkgs/modules/services/web-servers/apache-httpd/zabbix.nix
Eelco Dolstra 5ebdee3577 * Continued refactoring the tree: moved most Upstart jobs (namely
those that run daemons) to modules/services.  This probably broke
  some things since there are a few relative paths in modules
  (e.g. imports of system/ids.nix).
* Moved some PAM modules out of etc/pam.d to the directories of NixOS
  modules that use them.

svn path=/nixos/branches/modular-nixos/; revision=15717
2009-05-24 23:13:23 +00:00

69 lines
1.8 KiB
Nix

{config, pkgs, serverInfo}:
let
# The Zabbix PHP frontend needs to be able to write its
# configuration settings (the connection info to the database) to
# the "conf" subdirectory. So symlink $out/conf to some directory
# outside of the Nix store where we want to keep this stateful info.
# Note that different instances of the frontend will therefore end
# up with their own copies of the PHP sources. !!! Alternatively,
# we could generate zabbix.conf.php declaratively.
zabbixPHP = pkgs.runCommand "${pkgs.zabbixServer.name}-php" {} ''
cp -rs ${pkgs.zabbixServer}/share/zabbix/php $out
chmod -R u+w $out
#rm -rf $out/conf
ln -s ${config.stateDir}/zabbix.conf.php $out/conf/zabbix.conf.php
'';
in
{
extraModules = [
{ name = "php5"; path = "${pkgs.php}/modules/libphp5.so"; }
];
# !!! should also declare PHP options that Zabbix needs like the
# timezone and timeout.
extraConfig = ''
Alias ${config.urlPrefix}/ ${zabbixPHP}/
<Directory ${zabbixPHP}>
DirectoryIndex index.php
Order deny,allow
Allow from *
</Directory>
'';
startupScript = pkgs.writeScript "zabbix-startup-hook" ''
mkdir -p ${config.stateDir}
chown -R ${serverInfo.serverConfig.user} ${config.stateDir}
'';
# The frontend needs "ps" to find out whether zabbix_server is running.
extraServerPath = ["${pkgs.procps}/bin"];
options = {
urlPrefix = pkgs.lib.mkOption {
default = "/zabbix";
description = "
The URL prefix under which the Zabbix service appears.
Use the empty string to have it appear in the server root.
";
};
stateDir = pkgs.lib.mkOption {
default = "/var/lib/zabbix/frontend";
description = "
Directory where the dynamically generated configuration data
of the PHP frontend will be stored.
";
};
};
}