Loading pkgs/servers/sql/postgresql/ext/postgis.nix +34 −10 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ automake, libtool, which, sfcgal, withSfcgal ? false, }: let Loading @@ -47,7 +49,8 @@ buildPostgresqlExtension (finalAttrs: { hash = "sha256-wh7Lav2vnKzGWuSvvMFvAaGV7ynD+KgPsFUgujdtzlA="; }; buildInputs = [ buildInputs = [ libxml2 geos proj Loading @@ -55,7 +58,9 @@ buildPostgresqlExtension (finalAttrs: { json_c protobufc pcre2.dev ] ++ lib.optional stdenv.hostPlatform.isDarwin libiconv; ] ++ lib.optional stdenv.hostPlatform.isDarwin libiconv ++ lib.optional withSfcgal sfcgal; nativeBuildInputs = [ autoconf automake Loading Loading @@ -87,7 +92,7 @@ buildPostgresqlExtension (finalAttrs: { "--with-gdalconfig=${gdal}/bin/gdal-config" "--with-jsondir=${json_c.dev}" "--disable-extension-upgrades-install" ]; ] ++ lib.optional withSfcgal "--with-sfcgal=${sfcgal}/bin/sfcgal-config"; makeFlags = [ "PERL=${perl}/bin/perl" Loading Loading @@ -130,6 +135,25 @@ buildPostgresqlExtension (finalAttrs: { end$$; -- st_makepoint goes through c code select st_makepoint(1, 1); '' + lib.optionalString withSfcgal '' CREATE EXTENSION postgis_sfcgal; do $$ begin if postgis_sfcgal_version() <> '${sfcgal.version}' then raise '"%" does not match "${sfcgal.version}"', postgis_sfcgal_version(); end if; end$$; CREATE TABLE geometries ( name varchar, geom geometry(PolygonZ) NOT NULL ); INSERT INTO geometries(name, geom) VALUES ('planar geom', 'PolygonZ((1 1 0, 1 2 0, 2 2 0, 2 1 0, 1 1 0))'), ('nonplanar geom', 'PolygonZ((1 1 1, 1 2 -1, 2 2 2, 2 1 0, 1 1 1))'); SELECT name from geometries where cg_isplanar(geom); ''; }; Loading Loading
pkgs/servers/sql/postgresql/ext/postgis.nix +34 −10 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ automake, libtool, which, sfcgal, withSfcgal ? false, }: let Loading @@ -47,7 +49,8 @@ buildPostgresqlExtension (finalAttrs: { hash = "sha256-wh7Lav2vnKzGWuSvvMFvAaGV7ynD+KgPsFUgujdtzlA="; }; buildInputs = [ buildInputs = [ libxml2 geos proj Loading @@ -55,7 +58,9 @@ buildPostgresqlExtension (finalAttrs: { json_c protobufc pcre2.dev ] ++ lib.optional stdenv.hostPlatform.isDarwin libiconv; ] ++ lib.optional stdenv.hostPlatform.isDarwin libiconv ++ lib.optional withSfcgal sfcgal; nativeBuildInputs = [ autoconf automake Loading Loading @@ -87,7 +92,7 @@ buildPostgresqlExtension (finalAttrs: { "--with-gdalconfig=${gdal}/bin/gdal-config" "--with-jsondir=${json_c.dev}" "--disable-extension-upgrades-install" ]; ] ++ lib.optional withSfcgal "--with-sfcgal=${sfcgal}/bin/sfcgal-config"; makeFlags = [ "PERL=${perl}/bin/perl" Loading Loading @@ -130,6 +135,25 @@ buildPostgresqlExtension (finalAttrs: { end$$; -- st_makepoint goes through c code select st_makepoint(1, 1); '' + lib.optionalString withSfcgal '' CREATE EXTENSION postgis_sfcgal; do $$ begin if postgis_sfcgal_version() <> '${sfcgal.version}' then raise '"%" does not match "${sfcgal.version}"', postgis_sfcgal_version(); end if; end$$; CREATE TABLE geometries ( name varchar, geom geometry(PolygonZ) NOT NULL ); INSERT INTO geometries(name, geom) VALUES ('planar geom', 'PolygonZ((1 1 0, 1 2 0, 2 2 0, 2 1 0, 1 1 0))'), ('nonplanar geom', 'PolygonZ((1 1 1, 1 2 -1, 2 2 2, 2 1 0, 1 1 1))'); SELECT name from geometries where cg_isplanar(geom); ''; }; Loading