summary refs log tree commit diff
diff options
context:
space:
mode:
authorRĂ©mi Desgrange <rdesgrange@gmail.com>2017-10-11 18:06:20 +0200
committerRemi Desgrange <rdesgrange@gmail.com>2017-10-13 09:45:25 +0200
commit8dcaa5b313165d0acb3860cab97ece62e8421162 (patch)
treeb7cc66043019b3c7516f5e04a304a2bbabea0ca5
parent659c7484d1dbfb193085586bd8db8dc6260287f1 (diff)
downloadnixpkgs-8dcaa5b313165d0acb3860cab97ece62e8421162.tar
nixpkgs-8dcaa5b313165d0acb3860cab97ece62e8421162.tar.gz
nixpkgs-8dcaa5b313165d0acb3860cab97ece62e8421162.tar.bz2
nixpkgs-8dcaa5b313165d0acb3860cab97ece62e8421162.tar.lz
nixpkgs-8dcaa5b313165d0acb3860cab97ece62e8421162.tar.xz
nixpkgs-8dcaa5b313165d0acb3860cab97ece62e8421162.tar.zst
nixpkgs-8dcaa5b313165d0acb3860cab97ece62e8421162.zip
postgis: add v2.4.0
Add postgis 2.4.0

doesn't remove v2.3.1. There are some big change in 2.4 that people may
don't want. see https://postgis.net/docs/release_notes.html#idm41021

fix test call

modify following recommandation of lsix
-rw-r--r--nixos/release.nix1
-rw-r--r--nixos/tests/postgis.nix10
-rw-r--r--pkgs/development/libraries/postgis/default.nix26
3 files changed, 30 insertions, 7 deletions
diff --git a/nixos/release.nix b/nixos/release.nix
index ee706ff986d..4060e5df4ec 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -303,6 +303,7 @@ in rec {
   #tests.panamax = hydraJob (import tests/panamax.nix { system = "x86_64-linux"; });
   tests.peerflix = callTest tests/peerflix.nix {};
   tests.postgresql = callSubTests tests/postgresql.nix {};
+  tests.postgis = callTest tests/postgis.nix {};
   #tests.pgjwt = callTest tests/pgjwt.nix {};
   tests.printing = callTest tests/printing.nix {};
   tests.proxy = callTest tests/proxy.nix {};
diff --git a/nixos/tests/postgis.nix b/nixos/tests/postgis.nix
index 1dba5c363c0..f6ce3fe38ed 100644
--- a/nixos/tests/postgis.nix
+++ b/nixos/tests/postgis.nix
@@ -9,15 +9,11 @@ import ./make-test.nix ({ pkgs, ...} : {
       { pkgs, config, ... }:
 
       {
-        services.postgresql = let mypg = pkgs.postgresql95; in {
+        services.postgresql = let mypg = pkgs.postgresql100; in {
             enable = true;
             package = mypg;
-            extraPlugins = [ (pkgs.postgis.override { postgresql = mypg; }).v_2_2_1 ];
-            initialScript =  pkgs.writeText "postgresql-init.sql"
-          ''
-          CREATE ROLE postgres WITH superuser login createdb;
-          '';
-          };
+            extraPlugins = [ (pkgs.postgis.override { postgresql = mypg; }).v_2_4_0 ];
+        };
       };
   };
 
diff --git a/pkgs/development/libraries/postgis/default.nix b/pkgs/development/libraries/postgis/default.nix
index 2ba5a262e22..bdf537f4375 100644
--- a/pkgs/development/libraries/postgis/default.nix
+++ b/pkgs/development/libraries/postgis/default.nix
@@ -109,4 +109,30 @@ in rec {
     '';
   });
 
+  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";
+    '';
+  });
+
+
 }