postgresql: cleanup postgis (#54396)
postgis: cleanup Another part of https://github.com/NixOS/nixpkgs/pull/38698, though I did cleanup even more. Moving docs to separate output should save another 30MB. I did pin poppler to 0.61 just to be sure GDAL doesn't break again next time poppler changes internal APIs.
This commit is contained in:
parent
18f23748dc
commit
4fb8bc8238
@ -12,7 +12,9 @@ import ./make-test.nix ({ pkgs, ...} : {
|
|||||||
services.postgresql = let mypg = pkgs.postgresql_11; in {
|
services.postgresql = let mypg = pkgs.postgresql_11; in {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = mypg;
|
package = mypg;
|
||||||
extraPlugins = [ (pkgs.postgis.override { postgresql = mypg; }) ];
|
extraPlugins = with mypg.pkgs; [
|
||||||
|
postgis
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -22,5 +24,6 @@ import ./make-test.nix ({ pkgs, ...} : {
|
|||||||
$master->waitForUnit("postgresql");
|
$master->waitForUnit("postgresql");
|
||||||
$master->sleep(10); # Hopefully this is long enough!!
|
$master->sleep(10); # Hopefully this is long enough!!
|
||||||
$master->succeed("sudo -u postgres psql -c 'CREATE EXTENSION postgis;'");
|
$master->succeed("sudo -u postgres psql -c 'CREATE EXTENSION postgis;'");
|
||||||
|
$master->succeed("sudo -u postgres psql -c 'CREATE EXTENSION postgis_topology;'");
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
@ -10,79 +10,27 @@
|
|||||||
, pkgconfig
|
, pkgconfig
|
||||||
, file
|
, file
|
||||||
}:
|
}:
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
/*
|
|
||||||
|
|
||||||
### NixOS - usage:
|
|
||||||
==================
|
|
||||||
|
|
||||||
services.postgresql.extraPlugins = [ (pkgs.postgis.override { postgresql = pkgs.postgresql_9_5; }) ];
|
|
||||||
|
|
||||||
|
|
||||||
### important Postgis implementation details:
|
|
||||||
=============================================
|
|
||||||
|
|
||||||
Postgis provides a shared library implementing many operations. They are
|
|
||||||
exposed to the Postgres SQL interpreter by special SQL queries eg:
|
|
||||||
|
|
||||||
CREATE FUNCTION [...]
|
|
||||||
AS '[..]liblwgeom', 'lwhistogram2d_in' LANGUAGE 'C' IMMUTABLE STRICT; -- WITH (isstrict);
|
|
||||||
|
|
||||||
where liblwgeom is the shared library.
|
|
||||||
Postgis < 1.5 used absolute paths, in NixOS $libdir is always used.
|
|
||||||
|
|
||||||
Thus if you want to use postgresql dumps which were created by non NixOS
|
|
||||||
systems you have to adopt the library path.
|
|
||||||
|
|
||||||
|
|
||||||
### TODO:
|
|
||||||
=========
|
|
||||||
the bin commands to have gtk gui:
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
let
|
|
||||||
version = "2.5.1";
|
|
||||||
sha256 = "14bsh4kflp4bxilypkpmhrpldknc9s9vgiax8yfhxbisyib704zv";
|
|
||||||
in stdenv.mkDerivation rec {
|
|
||||||
name = "postgis-${version}";
|
name = "postgis-${version}";
|
||||||
|
version = "2.5.1";
|
||||||
|
|
||||||
|
outputs = [ "out" "doc" ];
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://download.osgeo.org/postgis/source/postgis-${builtins.toString version}.tar.gz";
|
url = "https://download.osgeo.org/postgis/source/postgis-${version}.tar.gz";
|
||||||
inherit sha256;
|
sha256 = "14bsh4kflp4bxilypkpmhrpldknc9s9vgiax8yfhxbisyib704zv";
|
||||||
};
|
};
|
||||||
|
|
||||||
# don't pass these vars to the builder
|
|
||||||
removeAttrs = ["sql_comments" "sql_srcs"];
|
|
||||||
|
|
||||||
preInstall = ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
'';
|
|
||||||
|
|
||||||
# create aliases for all commands adding version information
|
|
||||||
postInstall = ''
|
|
||||||
sql_srcs=$(for sql in ${builtins.toString sql_srcs}; do echo -n "$(find $out -iname "$sql") "; done )
|
|
||||||
|
|
||||||
for prog in $out/bin/*; do # */
|
|
||||||
ln -s $prog $prog-${version}
|
|
||||||
done
|
|
||||||
|
|
||||||
cp -r doc $out
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildInputs = [ libxml2 postgresql geos proj perl gdal json_c pkgconfig ];
|
buildInputs = [ libxml2 postgresql geos proj perl gdal json_c pkgconfig ];
|
||||||
|
dontDisableStatic = true;
|
||||||
sql_comments = "postgis_comments.sql";
|
|
||||||
|
|
||||||
sql_srcs = ["postgis.sql" "spatial_ref_sys.sql"];
|
|
||||||
|
|
||||||
# postgis config directory assumes /include /lib from the same root for json-c library
|
# postgis config directory assumes /include /lib from the same root for json-c library
|
||||||
NIX_LDFLAGS = "-L${stdenv.lib.getLib json_c}/lib";
|
NIX_LDFLAGS = "-L${stdenv.lib.getLib json_c}/lib";
|
||||||
|
|
||||||
dontDisableStatic = true;
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
|
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
|
||||||
configureFlags="--datadir=$out/share --datarootdir=$out/share --bindir=$out/bin --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev}"
|
configureFlags="--datadir=$out/share --datarootdir=$out/share --bindir=$out/bin --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev}"
|
||||||
|
|
||||||
makeFlags="PERL=${perl}/bin/perl datadir=$out/share pkglibdir=$out/lib bindir=$out/bin"
|
makeFlags="PERL=${perl}/bin/perl datadir=$out/share pkglibdir=$out/lib bindir=$out/bin"
|
||||||
'';
|
'';
|
||||||
postConfigure = ''
|
postConfigure = ''
|
||||||
@ -95,6 +43,20 @@ in stdenv.mkDerivation rec {
|
|||||||
"raster/scripts/python/Makefile";
|
"raster/scripts/python/Makefile";
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
preInstall = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
'';
|
||||||
|
|
||||||
|
# create aliases for all commands adding version information
|
||||||
|
postInstall = ''
|
||||||
|
for prog in $out/bin/*; do # */
|
||||||
|
ln -s $prog $prog-${version}
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir -p $doc/share/doc/postgis
|
||||||
|
mv doc/* $doc/share/doc/postgis/
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "Geographic Objects for PostgreSQL";
|
description = "Geographic Objects for PostgreSQL";
|
||||||
homepage = http://postgis.refractions.net;
|
homepage = http://postgis.refractions.net;
|
@ -1,5 +1,12 @@
|
|||||||
self: super: {
|
self: super: {
|
||||||
|
|
||||||
|
postgis = super.callPackage ./ext/postgis.nix {
|
||||||
|
gdal = self.gdal.override {
|
||||||
|
postgresql = self.postgresql;
|
||||||
|
poppler = self.poppler_0_61;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
pg_repack = super.callPackage ./ext/pg_repack.nix { };
|
pg_repack = super.callPackage ./ext/pg_repack.nix { };
|
||||||
|
|
||||||
pg_similarity = super.callPackage ./ext/pg_similarity.nix { };
|
pg_similarity = super.callPackage ./ext/pg_similarity.nix { };
|
||||||
|
@ -253,6 +253,7 @@ mapAliases ({
|
|||||||
pg_hll = postgresqlPackages.pg_hll;
|
pg_hll = postgresqlPackages.pg_hll;
|
||||||
pg_cron = postgresqlPackages.pg_cron;
|
pg_cron = postgresqlPackages.pg_cron;
|
||||||
pg_topn = postgresqlPackages.pg_topn;
|
pg_topn = postgresqlPackages.pg_topn;
|
||||||
|
postgis = postgresqlPackages.postgis;
|
||||||
# end
|
# end
|
||||||
procps-ng = procps; # added 2018-06-08
|
procps-ng = procps; # added 2018-06-08
|
||||||
prometheus-statsd-bridge = prometheus-statsd-exporter; # added 2017-08-27
|
prometheus-statsd-bridge = prometheus-statsd-exporter; # added 2017-08-27
|
||||||
|
@ -12088,8 +12088,6 @@ in
|
|||||||
buildPythonApplication click future six;
|
buildPythonApplication click future six;
|
||||||
};
|
};
|
||||||
|
|
||||||
postgis = callPackage ../development/libraries/postgis { };
|
|
||||||
|
|
||||||
protobuf = protobuf3_6;
|
protobuf = protobuf3_6;
|
||||||
|
|
||||||
protobuf3_6 = callPackage ../development/libraries/protobuf/3.6.nix { };
|
protobuf3_6 = callPackage ../development/libraries/protobuf/3.6.nix { };
|
||||||
|
Loading…
Reference in New Issue
Block a user