postgresql: always create the $out/bin directory

This is needed because some PostgreSQL plugins don't have a bin
directory. If only these plugins are listed in cfg.extraPlugins buildEnv
will turn $out/bin into a symbolic link to ${pg}/bin. Lateron we try to
rm $out/bin/{pg_config,postgres,pg_ctl} which will then fail because
$out/bin will be read-only.
This commit is contained in:
Bas van Dijk 2018-08-02 21:20:21 +02:00 committed by Mario Rodas
parent 74bc006bbb
commit 517c52ec2e
No known key found for this signature in database
GPG key ID: 4C4BEFD7B18DC5E8
9 changed files with 4 additions and 15 deletions

View file

@ -12,10 +12,13 @@ let
else pkgs.buildEnv {
name = "postgresql-and-plugins-${(builtins.parseDrvName pg.name).version}";
paths = [ pg pg.lib ] ++ cfg.extraPlugins;
# We include /bin to ensure the $out/bin directory is created which is
# needed because we'll be removing files from that directory in postBuild
# below. See #22653
pathsToLink = [ "/" "/bin" ];
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