3
0
Fork 0
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:
Domen Kožar 2018-11-27 19:16:21 +00:00
parent b3fb2d5c1c
commit d04fedd715
No known key found for this signature in database
GPG key ID: C2FFBCAFD2C24246
2 changed files with 7 additions and 2 deletions

View file

@ -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

View file

@ -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")
];