tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
Merge #17838: postgresql: Fix use with extensions
Vladimír Čunát
9 years ago
02217bf6
28e836a3
+63
-1
4 changed files
expand all
collapse all
unified
split
nixos
modules
services
databases
postgresql.nix
tests
postgis.nix
pkgs
servers
sql
postgresql
default.nix
specify_pkglibdir_at_runtime.patch
+3
-1
nixos/modules/services/databases/postgresql.nix
···
11
11
if cfg.extraPlugins == [] then pg
12
12
else pkgs.buildEnv {
13
13
name = "postgresql-and-plugins-${(builtins.parseDrvName pg.name).version}";
14
14
-
paths = [ pg ] ++ cfg.extraPlugins;
14
14
+
paths = [ pg pg.lib ] ++ cfg.extraPlugins;
15
15
+
buildInputs = [ pkgs.makeWrapper ];
15
16
postBuild =
16
17
''
17
18
mkdir -p $out/bin
18
19
rm $out/bin/{pg_config,postgres,pg_ctl}
19
20
cp --target-directory=$out/bin ${pg}/bin/{postgres,pg_config,pg_ctl}
21
21
+
wrapProgram $out/bin/postgres --set NIX_PGLIBDIR $out/lib
20
22
'';
21
23
};
22
24
+30
nixos/tests/postgis.nix
···
1
1
+
import ./make-test.nix ({ pkgs, ...} : {
2
2
+
name = "postgis";
3
3
+
meta = with pkgs.stdenv.lib.maintainers; {
4
4
+
maintainers = [ lsix ];
5
5
+
};
6
6
+
7
7
+
nodes = {
8
8
+
master =
9
9
+
{ pkgs, config, ... }:
10
10
+
11
11
+
{
12
12
+
services.postgresql = let mypg = pkgs.postgresql95; in {
13
13
+
enable = true;
14
14
+
package = mypg;
15
15
+
extraPlugins = [ (pkgs.postgis.override { postgresql = mypg; }).v_2_2_1 ];
16
16
+
initialScript = pkgs.writeText "postgresql-init.sql"
17
17
+
''
18
18
+
CREATE ROLE postgres WITH superuser login createdb;
19
19
+
'';
20
20
+
};
21
21
+
};
22
22
+
};
23
23
+
24
24
+
testScript = ''
25
25
+
startAll;
26
26
+
$master->waitForUnit("postgresql");
27
27
+
$master->sleep(10); # Hopefully this is long enough!!
28
28
+
$master->succeed("sudo -u postgres psql -c 'CREATE EXTENSION postgis;'");
29
29
+
'';
30
30
+
})
+1
pkgs/servers/sql/postgresql/default.nix
···
33
33
[ (if lib.versionAtLeast version "9.4" then ./disable-resolve_symlinks-94.patch else ./disable-resolve_symlinks.patch)
34
34
./less-is-more.patch
35
35
./hardcode-pgxs-path.patch
36
36
+
./specify_pkglibdir_at_runtime.patch
36
37
];
37
38
38
39
installTargets = [ "install-world" ];
+29
pkgs/servers/sql/postgresql/specify_pkglibdir_at_runtime.patch
···
1
1
+
diff -ur postgresql-9.5.3-orig/src/port/path.c postgresql-9.5.3/src/port/path.c
2
2
+
--- postgresql-9.5.3-orig/src/port/path.c 2016-05-09 22:50:23.000000000 +0200
3
3
+
+++ postgresql-9.5.3/src/port/path.c 2016-08-29 22:44:10.507377613 +0200
4
4
+
@@ -714,7 +714,11 @@
5
5
+
void
6
6
+
get_lib_path(const char *my_exec_path, char *ret_path)
7
7
+
{
8
8
+
- make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path);
9
9
+
+ char const * const nix_pglibdir = getenv("NIX_PGLIBDIR");
10
10
+
+ if(nix_pglibdir == NULL)
11
11
+
+ make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path);
12
12
+
+ else
13
13
+
+ make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path);
14
14
+
}
15
15
+
16
16
+
/*
17
17
+
@@ -723,7 +727,11 @@
18
18
+
void
19
19
+
get_pkglib_path(const char *my_exec_path, char *ret_path)
20
20
+
{
21
21
+
- make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path);
22
22
+
+ char const * const nix_pglibdir = getenv("NIX_PGLIBDIR");
23
23
+
+ if(nix_pglibdir == NULL)
24
24
+
+ make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path);
25
25
+
+ else
26
26
+
+ make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path);
27
27
+
}
28
28
+
29
29
+
/*