diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix index cffdbb96928..1a721e90a8d 100644 --- a/pkgs/servers/sql/postgresql/default.nix +++ b/pkgs/servers/sql/postgresql/default.nix @@ -58,13 +58,15 @@ let # Prevent a retained dependency on gcc-wrapper. substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${stdenv.cc}/bin/ld ld - # Remove static libraries in case dynamic are available. - for i in $out/lib/*.a; do - name="$(basename "$i")" - if [ -e "$lib/lib/''${name%.a}.so" ] || [ -e "''${i%.a}.so" ]; then - rm "$i" - fi - done + if [ -z "''${dontDisableStatic:-}" ]; then + # Remove static libraries in case dynamic are available. + for i in $out/lib/*.a; do + name="$(basename "$i")" + if [ -e "$lib/lib/''${name%.a}.so" ] || [ -e "''${i%.a}.so" ]; then + rm "$i" + fi + done + fi ''; postFixup = lib.optionalString (!stdenv.isDarwin)