Added PostgreSQL job.

svn path=/nixos/trunk/; revision=9830
This commit is contained in:
Michael Raskin 2007-12-03 04:48:31 +00:00
parent 5cd638aad8
commit aeced64d0e
3 changed files with 84 additions and 0 deletions

View File

@ -1252,6 +1252,52 @@
};
postgresql = {
enable = mkOption {
default = false;
description = "
Whether to run PostgreSQL.
";
};
port = mkOption {
default = "5432";
description = "
Port for PostgreSQL.
";
};
logDir = mkOption {
default = "/var/log/postgresql";
description = "
Log directory for PostgreSQL.
";
};
dataDir = mkOption {
default = "/var/db/postgresql";
description = "
Data directory for PostgreSQL.
";
};
subServices = mkOption {
default = [];
description = "
Subservices list. As it is already implememnted,
here is an interface...
";
};
allowedHosts = mkOption {
default = [];
description = "
Hosts (except localhost), who you allow to connect.
";
};
authMethod = mkOption {
default = " ident sameuser ";
description = "
How to authorize users.
Note: ident needs absolute trust to all allowed client hosts.";
};
};
};

View File

@ -167,6 +167,14 @@ let
(map (job: job.extraHttpdConfig) jobs);
})
# Postgres SQL server
++ optional config.services.postgresql.enable
(import ../upstart-jobs/postgresql.nix {
inherit config pkgs;
startDependency = if config.services.gw6c.enable then
"gw6c" else "network-interfaces";
})
# Samba service.
++ optional config.services.samba.enable
(import ../upstart-jobs/samba.nix {

View File

@ -0,0 +1,30 @@
args: with args;
let
cfg = config.services.postgresql;
postgresqlService = import ../services/postgresql {
inherit (pkgs) stdenv postgresql su;
inherit (cfg) port logDir dataDir
subServices allowedHosts
authMethod;
serverUser = "postgres";
};
in
{
name = "postgresql";
users = [ {
name = "postgres";
description = "PostgreSQL server user";
} ];
groups = [{name = "postgres";}];
job = "
description \"PostgreSQL server\"
start on ${startDependency}/started
stop on ${startDependency}/stop
respawn ${postgresqlService}/bin/control start
";
}