Merge branch 'master' of git://github.com/NixOS/nixos into x-updates

This commit is contained in:
Vladimír Čunát
2013-06-15 08:43:45 +02:00
10 changed files with 87 additions and 49 deletions

View File

@@ -54,7 +54,7 @@ in
options = {
environment.nix = mkOption {
default = pkgs.nixUnstable;
default = pkgs.nix;
merge = mergeOneOption;
description = ''
This option specifies the Nix package instance to use throughout the system.
@@ -220,7 +220,7 @@ in
};
binaryCaches = mkOption {
default = [ http://nixos.org/binary-cache ];
default = [ http://cache.nixos.org/ ];
type = types.listOf types.string;
description = ''
List of binary cache URLs used to obtain pre-built binaries

View File

@@ -34,6 +34,8 @@ let
''}
'';
useLocalPostgres = cfg.dbServer == "localhost" || cfg.dbServer == "";
in
{
@@ -51,7 +53,10 @@ in
services.zabbixServer.dbServer = mkOption {
default = "localhost";
description = "Hostname or IP address of the database server.";
description = ''
Hostname or IP address of the database server.
Use an empty string ("") to use peer authentication.
'';
};
services.zabbixServer.dbPassword = mkOption {
@@ -65,7 +70,7 @@ in
config = mkIf cfg.enable {
services.postgresql.enable = cfg.dbServer == "localhost";
services.postgresql.enable = useLocalPostgres;
users.extraUsers = singleton
{ name = "zabbix";
@@ -77,7 +82,7 @@ in
{ description = "Zabbix Server";
wantedBy = [ "multi-user.target" ];
after = optional (cfg.dbServer == "localhost") "postgresql.service";
after = optional useLocalPostgres "postgresql.service";
preStart =
''
@@ -88,8 +93,8 @@ in
${pkgs.postgresql}/bin/createuser --no-superuser --no-createdb --no-createrole zabbix || true
${pkgs.postgresql}/bin/createdb --owner zabbix zabbix || true
cat ${pkgs.zabbix.server}/share/zabbix/db/schema/postgresql.sql | ${pkgs.su}/bin/su -s "$SHELL" zabbix -c '${pkgs.postgresql}/bin/psql zabbix'
cat ${pkgs.zabbix.server}/share/zabbix/db/data/data.sql | ${pkgs.su}/bin/su -s "$SHELL" zabbix -c '${pkgs.postgresql}/bin/psql zabbix'
cat ${pkgs.zabbix.server}/share/zabbix/db/data/images_pgsql.sql | ${pkgs.su}/bin/su -s "$SHELL" zabbix -c '${pkgs.postgresql}/bin/psql zabbix'
cat ${pkgs.zabbix.server}/share/zabbix/db/data/data.sql | ${pkgs.su}/bin/su -s "$SHELL" zabbix -c '${pkgs.postgresql}/bin/psql zabbix'
touch "${libDir}/db-created"
fi
'';
@@ -100,6 +105,7 @@ in
serviceConfig.Type = "forking";
serviceConfig.Restart = "always";
serviceConfig.RestartSec = 2;
serviceConfig.PIDFile = pidFile;
};
};

View File

@@ -52,6 +52,8 @@ in
mkdir -m 0755 -p /var/db/nscd
'';
restartTriggers = [ config.environment.etc.hosts.source ];
serviceConfig =
{ ExecStart = "@${pkgs.glibc}/sbin/nscd nscd -f ${./nscd.conf}";
Type = "forking";

View File

@@ -93,7 +93,7 @@ with pkgs.lib;
[Service]
Environment=TERM=linux
Environment=LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login %I 115200,38400,9600
ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login %I 115200,57600,38400,9600
Type=idle
Restart=always
RestartSec=0

View File

@@ -11,10 +11,11 @@ let
# we could generate zabbix.conf.php declaratively.
zabbixPHP = pkgs.runCommand "${pkgs.zabbix.server.name}-php" {}
''
cp -rs ${pkgs.zabbix.server}/share/zabbix/php $out
cp -rs ${pkgs.zabbix.server}/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
ln -s "${if config.configFile == null
then "${config.stateDir}/zabbix.conf.php"
else config.configFile}" "$out/conf/zabbix.conf.php"
'';
in
@@ -27,6 +28,7 @@ in
''
post_max_size = 32M
max_execution_time = 300
max_input_time = 300
'';
extraConfig = ''
@@ -57,6 +59,16 @@ in
";
};
configFile = pkgs.lib.mkOption {
default = null;
type = with pkgs.lib.types; nullOr path;
description = ''
The configuration file (zabbix.conf.php) which contains the database
connection settings. If not set, the configuration settings will created
by the web installer.
'';
};
stateDir = pkgs.lib.mkOption {
default = "/var/lib/zabbix/frontend";
description = "