Added PostgreSQL job.
svn path=/nixos/trunk/; revision=9830
This commit is contained in:
parent
5cd638aad8
commit
aeced64d0e
@ -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.";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -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 {
|
||||
|
30
upstart-jobs/postgresql.nix
Normal file
30
upstart-jobs/postgresql.nix
Normal 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
|
||||
";
|
||||
}
|
Loading…
Reference in New Issue
Block a user