Skip to content

Commit

Permalink
postgresql: enable systemd service notification on 9.6+
Browse files Browse the repository at this point in the history
This results in a marginal closure size increase of ~137mb -> ~141mb.
This only affects the 'out' output, not the 'lib' output, so
libpq-dependent expressions should not bloat as a result of this.

The type of the systemd service is changed to 'notify' on 9.6+, which
will help identify when Postgres is starting/shutting down.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
  • Loading branch information
thoughtpolice authored and basvandijk committed Sep 9, 2018
1 parent 6f6dcc0 commit 1e83cf3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions nixos/modules/services/databases/postgresql.nix
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ in
# Give Postgres a decent amount of time to clean up after
# receiving systemd's SIGINT.
TimeoutSec = 120;

Type = if versionAtLeast postgresqlPackage.psqlSchema "9.6" then "notify" else "simple";
};

# Wait for PostgreSQL to be ready to accept connections.
Expand Down
8 changes: 6 additions & 2 deletions pkgs/servers/sql/postgresql/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, glibc, fetchurl, zlib, readline, libossp_uuid, openssl, libxml2, makeWrapper, tzdata }:
{ stdenv, lib, fetchurl, makeWrapper
, glibc, zlib, readline, libossp_uuid, openssl, libxml2, tzdata, systemd
}:

let

Expand All @@ -17,7 +19,8 @@ let

buildInputs =
[ zlib readline openssl libxml2 makeWrapper ]
++ lib.optionals (!stdenv.isDarwin) [ libossp_uuid ];
++ lib.optionals (!stdenv.isDarwin) [ libossp_uuid ]
++ lib.optionals (atLeast "9.6" && !stdenv.isDarwin) [ systemd ];

enableParallelBuilding = true;

Expand All @@ -34,6 +37,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")
];

Expand Down

0 comments on commit 1e83cf3

Please sign in to comment.