postgresql: Fix use with extensions

Fixes #15512 and #16032

With the multi output, postgresql cannot find at runtime what is its
basedir when looking for libdir and pkglibdir. This commit fixes that.
This commit is contained in:
Lancelot SIX
2016-08-19 09:06:40 +02:00
parent f976fa40a2
commit 5b8072fff6
4 changed files with 63 additions and 1 deletions

View File

@@ -11,12 +11,14 @@ let
if cfg.extraPlugins == [] then pg
else pkgs.buildEnv {
name = "postgresql-and-plugins-${(builtins.parseDrvName pg.name).version}";
paths = [ pg ] ++ cfg.extraPlugins;
paths = [ pg pg.lib ] ++ cfg.extraPlugins;
buildInputs = [ pkgs.makeWrapper ];
postBuild =
''
mkdir -p $out/bin
rm $out/bin/{pg_config,postgres,pg_ctl}
cp --target-directory=$out/bin ${pg}/bin/{postgres,pg_config,pg_ctl}
wrapProgram $out/bin/postgres --set NIX_PGLIBDIR $out/lib
'';
};