PostGIS PostgreSQL 12 or 13


I am trying to use PostGIS with PostgreSQL 12 or newer, but it looks like the postgres packages such as postgis and pgrouting are only available for PostgreSQL 11. What’s the recommended way to install them?

I am also curious why is PosgreSQL 11 the default Postgres. It’s more than two years old.

Thank you.

On NixOS you should be able to supply something like:

  services.postgresql = {
    enable = true;
    package = pkgs.postgresql_12;
    extraPlugins = [ pkgs.postgis.override { postgresql = pkgs.postgresql_12; } ];  

Something very comparable also works with nix-darwin for MacOS users. I need Postgis 2.5.x so my version is slightly more convoluted, but only just.

Thank you. I ended up getting it to work by simply using the below build inputs for my nix shell. I’m surprised that it worked, though, since the docs state that the packages should match the postgres version, and I didn’t see packages for PostgreSQL 12. I’ll dig into the code when I get a chance to understand why it worked.

  buildInputs = [
    (postgresql_12.withPackages (p: [ p.postgis ]))