2019-12-15 17:32:18 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
2016-08-19 07:06:40 +00:00
|
|
|
name = "postgis";
|
2021-01-10 19:08:30 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2016-08-19 07:06:40 +00:00
|
|
|
maintainers = [ lsix ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
master =
|
2018-07-20 20:56:59 +00:00
|
|
|
{ pkgs, ... }:
|
2016-08-19 07:06:40 +00:00
|
|
|
|
|
|
|
{
|
2023-09-26 20:49:44 +00:00
|
|
|
services.postgresql = {
|
2016-08-19 07:06:40 +00:00
|
|
|
enable = true;
|
2023-09-26 20:49:44 +00:00
|
|
|
package = pkgs.postgresql;
|
|
|
|
extraPlugins = ps: with ps; [
|
2019-01-26 19:15:43 +00:00
|
|
|
postgis
|
|
|
|
];
|
2017-10-11 16:06:20 +00:00
|
|
|
};
|
2016-08-19 07:06:40 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2019-12-15 17:32:18 +00:00
|
|
|
start_all()
|
|
|
|
master.wait_for_unit("postgresql")
|
|
|
|
master.sleep(10) # Hopefully this is long enough!!
|
|
|
|
master.succeed("sudo -u postgres psql -c 'CREATE EXTENSION postgis;'")
|
2023-12-23 17:48:49 +00:00
|
|
|
master.succeed("sudo -u postgres psql -c 'CREATE EXTENSION postgis_raster;'")
|
2019-12-15 17:32:18 +00:00
|
|
|
master.succeed("sudo -u postgres psql -c 'CREATE EXTENSION postgis_topology;'")
|
2024-10-03 16:00:24 +00:00
|
|
|
master.succeed("sudo -u postgres psql -c 'select postgis_version();'")
|
|
|
|
master.succeed("[ \"$(sudo -u postgres psql --no-psqlrc --tuples-only -c 'select postgis_version();')\" = \" ${
|
|
|
|
pkgs.lib.versions.major pkgs.postgis.version
|
|
|
|
}.${
|
|
|
|
pkgs.lib.versions.minor pkgs.postgis.version
|
|
|
|
} USE_GEOS=1 USE_PROJ=1 USE_STATS=1\" ]")
|
|
|
|
# st_makepoint goes through c code
|
|
|
|
master.succeed("sudo -u postgres psql --no-psqlrc --tuples-only -c 'select st_makepoint(1, 1)'")
|
2016-08-19 07:06:40 +00:00
|
|
|
'';
|
|
|
|
})
|