diff --git a/pkgs/servers/sql/postgresql/ext/postgis.nix b/pkgs/servers/sql/postgresql/ext/postgis.nix index de9d7eb1305..63b8a39b0e2 100644 --- a/pkgs/servers/sql/postgresql/ext/postgis.nix +++ b/pkgs/servers/sql/postgresql/ext/postgis.nix @@ -10,6 +10,7 @@ , pkgconfig , file , protobufc +, libiconv }: stdenv.mkDerivation rec { name = "postgis-${version}"; @@ -22,7 +23,8 @@ stdenv.mkDerivation rec { sha256 = "0pnva72f2w4jcgnl1y7nw5rdly4ipx3hji4c9yc9s0hna1n2ijxn"; }; - buildInputs = [ libxml2 postgresql geos proj gdal json_c protobufc ]; + buildInputs = [ libxml2 postgresql geos proj gdal json_c protobufc ] + ++ stdenv.lib.optional stdenv.isDarwin libiconv; nativeBuildInputs = [ perl pkgconfig ]; dontDisableStatic = true; @@ -43,14 +45,18 @@ stdenv.mkDerivation rec { sed -i "s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g " \ "raster/scripts/python/Makefile"; - ''; - - preInstall = '' mkdir -p $out/bin + + # postgis' build system assumes it is being installed to the same place as postgresql, and looks + # for the postgres binary relative to $PREFIX. We gently support this system using an illusion. + ln -s ${postgresql}/bin/postgres $out/bin/postgres ''; # create aliases for all commands adding version information postInstall = '' + # Teardown the illusory postgres used for building; see postConfigure. + rm $out/bin/postgres + for prog in $out/bin/*; do # */ ln -s $prog $prog-${version} done @@ -64,6 +70,6 @@ stdenv.mkDerivation rec { homepage = https://postgis.net/; license = licenses.gpl2; maintainers = [ maintainers.marcweber ]; - platforms = platforms.linux; + inherit (postgresql.meta) platforms; }; }