Merge pull request #35243 from FRidh/postgis
postgis: get rid of composableDerivation
This commit is contained in:
commit
d328ba753e
@ -122,7 +122,7 @@ in
|
||||
extraPlugins = mkOption {
|
||||
type = types.listOf types.path;
|
||||
default = [];
|
||||
example = literalExample "[ (pkgs.postgis.override { postgresql = pkgs.postgresql94; }).v_2_1_4 ]";
|
||||
example = literalExample "[ (pkgs.postgis.override { postgresql = pkgs.postgresql94; }) ]";
|
||||
description = ''
|
||||
When this list contains elements a new store path is created.
|
||||
PostgreSQL and the elements are symlinked into it. Then pg_config,
|
||||
|
@ -12,7 +12,7 @@ import ./make-test.nix ({ pkgs, ...} : {
|
||||
services.postgresql = let mypg = pkgs.postgresql100; in {
|
||||
enable = true;
|
||||
package = mypg;
|
||||
extraPlugins = [ (pkgs.postgis.override { postgresql = mypg; }).v_2_4_0 ];
|
||||
extraPlugins = [ (pkgs.postgis.override { postgresql = mypg; }) ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
102
pkgs/development/libraries/postgis/2.3.nix
Normal file
102
pkgs/development/libraries/postgis/2.3.nix
Normal file
@ -0,0 +1,102 @@
|
||||
{ fetchurl
|
||||
, stdenv
|
||||
, perl
|
||||
, libxml2
|
||||
, postgresql
|
||||
, geos
|
||||
, proj
|
||||
, flex
|
||||
, gdal
|
||||
, json_c
|
||||
, pkgconfig
|
||||
, file
|
||||
}:
|
||||
|
||||
/*
|
||||
|
||||
### NixOS - usage:
|
||||
==================
|
||||
|
||||
services.postgresql.extraPlugins = [ (pkgs.postgis.override { postgresql = pkgs.postgresql95; }) ];
|
||||
|
||||
|
||||
### 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.3.1";
|
||||
sha256 = "0xd21h2k6x3i1b3z6pgm3pmkfpxm6irxd5wbx68acjndjgd6p3ac";
|
||||
in stdenv.mkDerivation rec {
|
||||
name = "postgis-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://download.osgeo.org/postgis/source/postgis-${builtins.toString version}.tar.gz";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
# don't pass these vars to the builder
|
||||
removeAttrs = ["sql_comments" "sql_srcs"];
|
||||
|
||||
# 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 ];
|
||||
|
||||
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
|
||||
NIX_LDFLAGS = "-L${stdenv.lib.getLib json_c}/lib";
|
||||
|
||||
dontDisableStatic = true;
|
||||
preConfigure = ''
|
||||
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}"
|
||||
makeFlags="PERL=${perl}/bin/perl datadir=$out/share pkglibdir=$out/lib bindir=$out/bin"
|
||||
'';
|
||||
postConfigure = ''
|
||||
sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
|
||||
s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
|
||||
" \
|
||||
"raster/loader/Makefile";
|
||||
sed -i "s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
|
||||
" \
|
||||
"raster/scripts/python/Makefile";
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Geographic Objects for PostgreSQL";
|
||||
homepage = http://postgis.refractions.net;
|
||||
license = licenses.gpl2;
|
||||
maintainers = [ maintainers.marcweber ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
@ -1,11 +1,23 @@
|
||||
args@{fetchurl, composableDerivation, stdenv, perl, libxml2, postgresql, geos, proj, flex, gdal, json_c, pkgconfig, file, ...}:
|
||||
{ fetchurl
|
||||
, stdenv
|
||||
, perl
|
||||
, libxml2
|
||||
, postgresql
|
||||
, geos
|
||||
, proj
|
||||
, flex
|
||||
, gdal
|
||||
, json_c
|
||||
, pkgconfig
|
||||
, file
|
||||
}:
|
||||
|
||||
/*
|
||||
|
||||
### NixOS - usage:
|
||||
==================
|
||||
|
||||
services.postgresql.extraPlugins = [ (pkgs.postgis.override { postgresql = pkgs.postgresql95; }).v_2_3_1 ];
|
||||
services.postgresql.extraPlugins = [ (pkgs.postgis.override { postgresql = pkgs.postgresql95; }) ];
|
||||
|
||||
|
||||
### important Postgis implementation details:
|
||||
@ -31,108 +43,60 @@ args@{fetchurl, composableDerivation, stdenv, perl, libxml2, postgresql, geos, p
|
||||
|
||||
|
||||
let
|
||||
pgDerivationBase = composableDerivation.composableDerivation {} ( fix :
|
||||
version = "2.4.0";
|
||||
sha256 = "02baa90f04da41e04b6c18eedfda53110c45ae943d4e65050f6d202f7de07d29";
|
||||
in stdenv.mkDerivation rec {
|
||||
name = "postgis-${version}";
|
||||
|
||||
let version = fix.fixed.version; in {
|
||||
src = fetchurl {
|
||||
url = "http://download.osgeo.org/postgis/source/postgis-${builtins.toString version}.tar.gz";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
name = "postgis-${version}";
|
||||
# don't pass these vars to the builder
|
||||
removeAttrs = ["sql_comments" "sql_srcs"];
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://postgis.refractions.net/download/postgis-${fix.fixed.version}.tar.gz";
|
||||
inherit (fix.fixed) sha256;
|
||||
};
|
||||
# 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 )
|
||||
|
||||
# don't pass these vars to the builder
|
||||
removeAttrs = ["hash" "sql_comments" "sql_srcs"];
|
||||
for prog in $out/bin/*; do # */
|
||||
ln -s $prog $prog-${version}
|
||||
done
|
||||
|
||||
preConfigure = ''
|
||||
configureFlags="--datadir=$out/share --datarootdir=$out/share --bindir=$out/bin"
|
||||
makeFlags="PERL=${perl}/bin/perl datadir=$out/share pkglibdir=$out/lib bindir=$out/bin"
|
||||
'';
|
||||
cp -r doc $out
|
||||
'';
|
||||
|
||||
# create aliases for all commands adding version information
|
||||
postInstall = ''
|
||||
buildInputs = [ libxml2 postgresql geos proj perl gdal json_c pkgconfig ];
|
||||
|
||||
sql_srcs=$(for sql in ${builtins.toString fix.fixed.sql_srcs}; do echo -n "$(find $out -iname "$sql") "; done )
|
||||
sql_comments = "postgis_comments.sql";
|
||||
|
||||
for prog in $out/bin/*; do # */
|
||||
ln -s $prog $prog-${version}
|
||||
done
|
||||
sql_srcs = ["postgis.sql" "spatial_ref_sys.sql"];
|
||||
|
||||
cp -r doc $out
|
||||
'';
|
||||
|
||||
buildInputs = [libxml2 postgresql geos proj perl];
|
||||
|
||||
sql_comments = "postgis_comments.sql";
|
||||
|
||||
meta = {
|
||||
description = "Geographic Objects for PostgreSQL";
|
||||
homepage = http://postgis.refractions.net;
|
||||
license = stdenv.lib.licenses.gpl2;
|
||||
maintainers = [stdenv.lib.maintainers.marcweber];
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
};
|
||||
});
|
||||
|
||||
pgDerivationBaseNewer = pgDerivationBase.merge (fix: {
|
||||
src = fetchurl {
|
||||
url = "http://download.osgeo.org/postgis/source/postgis-${builtins.toString fix.fixed.version}.tar.gz";
|
||||
inherit (fix.fixed) sha256;
|
||||
};
|
||||
});
|
||||
|
||||
in rec {
|
||||
|
||||
v_2_3_1 = pgDerivationBaseNewer.merge ( fix : {
|
||||
version = "2.3.1";
|
||||
sha256 = "0xd21h2k6x3i1b3z6pgm3pmkfpxm6irxd5wbx68acjndjgd6p3ac";
|
||||
sql_srcs = ["postgis.sql" "spatial_ref_sys.sql"];
|
||||
builtInputs = [gdal json_c pkgconfig];
|
||||
|
||||
# postgis config directory assumes /include /lib from the same root for json-c library
|
||||
NIX_LDFLAGS = "-L${stdenv.lib.getLib json_c}/lib";
|
||||
|
||||
dontDisableStatic = true;
|
||||
preConfigure = ''
|
||||
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
|
||||
configureFlags="$configureFlags --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev}"
|
||||
'';
|
||||
postConfigure = ''
|
||||
sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
|
||||
s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
|
||||
" \
|
||||
"raster/loader/Makefile";
|
||||
sed -i "s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
|
||||
" \
|
||||
"raster/scripts/python/Makefile";
|
||||
'';
|
||||
});
|
||||
|
||||
v_2_4_0 = pgDerivationBaseNewer.merge ( fix : {
|
||||
version = "2.4.0";
|
||||
sha256 = "02baa90f04da41e04b6c18eedfda53110c45ae943d4e65050f6d202f7de07d29";
|
||||
sql_srcs = ["postgis.sql" "spatial_ref_sys.sql"];
|
||||
builtInputs = [gdal json_c pkgconfig];
|
||||
|
||||
# postgis config directory assumes /include /lib from the same root for json-c library
|
||||
NIX_LDFLAGS = "-L${stdenv.lib.getLib json_c}/lib";
|
||||
|
||||
dontDisableStatic = true;
|
||||
preConfigure = ''
|
||||
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
|
||||
configureFlags="$configureFlags --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev}"
|
||||
'';
|
||||
postConfigure = ''
|
||||
sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
|
||||
s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
|
||||
" \
|
||||
"raster/loader/Makefile";
|
||||
sed -i "s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
|
||||
" \
|
||||
"raster/scripts/python/Makefile";
|
||||
'';
|
||||
});
|
||||
# postgis config directory assumes /include /lib from the same root for json-c library
|
||||
NIX_LDFLAGS = "-L${stdenv.lib.getLib json_c}/lib";
|
||||
|
||||
dontDisableStatic = true;
|
||||
preConfigure = ''
|
||||
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}"
|
||||
makeFlags="PERL=${perl}/bin/perl datadir=$out/share pkglibdir=$out/lib bindir=$out/bin"
|
||||
'';
|
||||
postConfigure = ''
|
||||
sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
|
||||
s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
|
||||
" \
|
||||
"raster/loader/Makefile";
|
||||
sed -i "s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
|
||||
" \
|
||||
"raster/scripts/python/Makefile";
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Geographic Objects for PostgreSQL";
|
||||
homepage = http://postgis.refractions.net;
|
||||
license = licenses.gpl2;
|
||||
maintainers = [ maintainers.marcweber ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
|
@ -10788,6 +10788,7 @@ with pkgs;
|
||||
};
|
||||
|
||||
postgis = callPackage ../development/libraries/postgis { };
|
||||
postgis_2_3 = callPackage ../development/libraries/postgis/2.3.nix { };
|
||||
|
||||
protobuf = callPackage ../development/libraries/protobuf/3.4.nix { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user