Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgis extension doesn't work #15512

Closed
thall opened this issue May 17, 2016 · 6 comments
Closed

Postgis extension doesn't work #15512

thall opened this issue May 17, 2016 · 6 comments

Comments

@thall
Copy link
Contributor

thall commented May 17, 2016

Issue description

Not able to create postgis extension

Steps to reproduce

$ psql -U postgres -h localhost -c "create database dummy"
CREATE DATABASE

$ psql -U postgres -h localhost -d dummy -c "create extension postgis"
ERROR:  could not access file "$libdir/postgis-2.2": No such file or directory

Technical details

  • System: (NixOS: nixos-version, Ubuntu/Fedora: lsb_release -a, ...)
    16.09pre83703.0373eb8 (Flounder)
  • Nix version: (run nix-env --version)
    nix-env (Nix) 1.11.2
  • Nixpkgs version: (run nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion)
    "16.09pre83703.0373eb8"
...
  services.postgresql = {
    enable = true;
    package = pkgs.postgresql95;
    extraPlugins = [ (pkgs.postgis.override { postgresql = pkgs.postgresql95; }).v_2_2_1 ];
  };
...
@thall
Copy link
Contributor Author

thall commented May 17, 2016

Ping @paraseba

@paraseba
Copy link
Contributor

I was able to reproduce it. Let me see if I can fix it

@paraseba
Copy link
Contributor

I think something like the following could work, but unfortunately I can't test it because my tree is not building (zfs problems) and I don't know how to build a nixos module independently. Any chance you could give it a try @thall ?

diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix
index 80ee32f..aabbfa5 100644
--- a/nixos/modules/services/databases/postgresql.nix
+++ b/nixos/modules/services/databases/postgresql.nix
@@ -11,7 +11,7 @@ let
     if cfg.extraPlugins == [] then pg
     else pkgs.buildEnv {
       name = "postgresql-and-plugins-${(builtins.parseDrvName pg.name).version}";
-      paths = [ pg ] ++ cfg.extraPlugins;
+      paths = concatMap ( p: [ p (getLib p) ] ) ( [ pg ] ++ cfg.extraPlugins );
       postBuild =
         ''
           mkdir -p $out/bin

@thall
Copy link
Contributor Author

thall commented May 18, 2016

I will give it a try, i havent rebuild nixos based on the git-repo with custom patches before. Im relative new to nixos.

@paraseba
Copy link
Contributor

I don't think it's working. The problem is still pg_config. In the current version pg_config --libdir points to the postgresql-lib path, in the old working version it pointed to nixos's postgresq-and-plugins which is where the DLLs are. Need to find a way to bring that behavior back in the new split outputs world.

@thall
Copy link
Contributor Author

thall commented May 30, 2016

Im using an docker image with postgres and postgis as an workaround for the moment.

lsix added a commit to lsix/nixpkgs that referenced this issue Sep 2, 2016
Fixes NixOS#15512 and NixOS#16032

With the multi output, postgresql cannot find at runtime what is its
basedir when looking for libdir and pkglibdir. This commit fixes that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants