1diff -ur postgresql-9.5.3-orig/src/port/path.c postgresql-9.5.3/src/port/path.c
2--- postgresql-9.5.3-orig/src/port/path.c 2016-05-09 22:50:23.000000000 +0200
3+++ postgresql-9.5.3/src/port/path.c 2016-08-29 22:44:10.507377613 +0200
4@@ -714,7 +714,11 @@
5 void
6 get_lib_path(const char *my_exec_path, char *ret_path)
7 {
8- make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path);
9+ char const * const nix_pglibdir = getenv("NIX_PGLIBDIR");
10+ if(nix_pglibdir == NULL)
11+ make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path);
12+ else
13+ make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path);
14 }
15
16 /*
17@@ -723,7 +727,11 @@
18 void
19 get_pkglib_path(const char *my_exec_path, char *ret_path)
20 {
21- make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path);
22+ char const * const nix_pglibdir = getenv("NIX_PGLIBDIR");
23+ if(nix_pglibdir == NULL)
24+ make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path);
25+ else
26+ make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path);
27 }
28
29 /*