forked from mirrors/nixpkgs
postgresql: Enable systemd integration for 9.6+
This allows, finally, proper detection when postgresql is ready to accept connections. Until now, it was possible that services depending on postgresql would fail in a race condition trying to connect to postgresql.
This commit is contained in:
parent
b3fb2d5c1c
commit
d04fedd715
|
@ -238,6 +238,9 @@ in
|
|||
User = "postgres";
|
||||
Group = "postgres";
|
||||
PermissionsStartOnly = true;
|
||||
Type = if lib.versionAtLeast cfg.package.version "9.6"
|
||||
then "notify"
|
||||
else "simple";
|
||||
|
||||
# Shut down Postgres using SIGINT ("Fast Shutdown mode"). See
|
||||
# http://www.postgresql.org/docs/current/static/server-shutdown.html
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
{ lib, stdenv, glibc, fetchurl, zlib, readline, libossp_uuid, openssl, libxml2, makeWrapper, tzdata }:
|
||||
{ lib, stdenv, glibc, fetchurl, zlib, readline, libossp_uuid, openssl, libxml2, makeWrapper, tzdata, systemd }:
|
||||
|
||||
let
|
||||
|
||||
common = { version, sha256, psqlSchema }:
|
||||
let atLeast = lib.versionAtLeast version; in stdenv.mkDerivation (rec {
|
||||
name = "postgresql-${version}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
|
||||
|
@ -15,7 +16,7 @@ let
|
|||
setOutputFlags = false; # $out retains configureFlags :-/
|
||||
|
||||
buildInputs =
|
||||
[ zlib readline openssl libxml2 makeWrapper ]
|
||||
[ zlib readline openssl libxml2 makeWrapper systemd ]
|
||||
++ lib.optionals (!stdenv.isDarwin) [ libossp_uuid ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
@ -33,6 +34,7 @@ let
|
|||
"--sysconfdir=/etc"
|
||||
"--libdir=$(lib)/lib"
|
||||
"--with-system-tzdata=${tzdata}/share/zoneinfo"
|
||||
(lib.optionalString (atLeast "9.6" && !stdenv.isDarwin) "--with-systemd")
|
||||
(if stdenv.isDarwin then "--with-uuid=e2fs" else "--with-ossp-uuid")
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in a new issue