diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix index f592be0e768b..aeab445a9983 100644 --- a/nixos/modules/services/databases/postgresql.nix +++ b/nixos/modules/services/databases/postgresql.nix @@ -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 diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix index dce158ebed9d..c91a9bb8b9ab 100644 --- a/pkgs/servers/sql/postgresql/default.nix +++ b/pkgs/servers/sql/postgresql/default.nix @@ -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") ];