summary refs log tree commit diff
path: root/nixos/tests/postgis.nix
diff options
context:
space:
mode:
authorLancelot SIX <lsix@lancelotsix.com>2016-08-19 09:06:40 +0200
committerLancelot SIX <lsix@lancelotsix.com>2016-09-02 11:51:21 +0200
commit5b8072fff6afe5a455d06b8b8f37a6d7e0519986 (patch)
tree9a4bf5397bbff921b78261cb347357f81801032b /nixos/tests/postgis.nix
parentf976fa40a238e9bf78fd1a875dbd2f23318acf6a (diff)
downloadnixpkgs-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar
nixpkgs-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar.gz
nixpkgs-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar.bz2
nixpkgs-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar.lz
nixpkgs-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar.xz
nixpkgs-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.tar.zst
nixpkgs-5b8072fff6afe5a455d06b8b8f37a6d7e0519986.zip
postgresql: Fix use with extensions
Fixes #15512 and #16032

With the multi output, postgresql cannot find at runtime what is its
basedir when looking for libdir and pkglibdir. This commit fixes that.
Diffstat (limited to 'nixos/tests/postgis.nix')
-rw-r--r--nixos/tests/postgis.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/nixos/tests/postgis.nix b/nixos/tests/postgis.nix
new file mode 100644
index 00000000000..1dba5c363c0
--- /dev/null
+++ b/nixos/tests/postgis.nix
@@ -0,0 +1,30 @@
+import ./make-test.nix ({ pkgs, ...} : {
+  name = "postgis";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ lsix ];
+  };
+
+  nodes = {
+    master =
+      { pkgs, config, ... }:
+
+      {
+        services.postgresql = let mypg = pkgs.postgresql95; 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;
+          '';
+          };
+      };
+  };
+
+  testScript = ''
+    startAll;
+    $master->waitForUnit("postgresql");
+    $master->sleep(10); # Hopefully this is long enough!!
+    $master->succeed("sudo -u postgres psql -c 'CREATE EXTENSION postgis;'");
+  '';
+})