about summary refs log tree commit diff
path: root/pkgs/servers/sql
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-05-30 22:30:15 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2019-05-30 22:30:15 -0400
commit376bb5108a9bfcfe136872a94b4b96b655c63842 (patch)
tree73503bf69e1ba16812fafe5d89571433a3b04f2b /pkgs/servers/sql
parenteb9a9bb22aa309e857ce7cffb158e80b35869980 (diff)
downloadnixlib-376bb5108a9bfcfe136872a94b4b96b655c63842.tar
nixlib-376bb5108a9bfcfe136872a94b4b96b655c63842.tar.gz
nixlib-376bb5108a9bfcfe136872a94b4b96b655c63842.tar.bz2
nixlib-376bb5108a9bfcfe136872a94b4b96b655c63842.tar.lz
nixlib-376bb5108a9bfcfe136872a94b4b96b655c63842.tar.xz
nixlib-376bb5108a9bfcfe136872a94b4b96b655c63842.tar.zst
nixlib-376bb5108a9bfcfe136872a94b4b96b655c63842.zip
postgresql: install in $out/share/postgresql
Fixes #62235
Diffstat (limited to 'pkgs/servers/sql')
-rw-r--r--pkgs/servers/sql/postgresql/default.nix3
-rw-r--r--pkgs/servers/sql/postgresql/patches/findstring.patch59
2 files changed, 61 insertions, 1 deletions
diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix
index 6e62aee13752..423354a44806 100644
--- a/pkgs/servers/sql/postgresql/default.nix
+++ b/pkgs/servers/sql/postgresql/default.nix
@@ -38,7 +38,7 @@ let
 
     enableParallelBuilding = !stdenv.isDarwin;
 
-    makeFlags = [ "world" ];
+    buildFlags = [ "world" ];
 
     NIX_CFLAGS_COMPILE = [ "-I${libxml2.dev}/include/libxml2" ];
 
@@ -60,6 +60,7 @@ let
         (if atLeast "9.6" then ./patches/less-is-more-96.patch             else ./patches/less-is-more.patch)
         (if atLeast "9.6" then ./patches/hardcode-pgxs-path-96.patch       else ./patches/hardcode-pgxs-path.patch)
         ./patches/specify_pkglibdir_at_runtime.patch
+        ./patches/findstring.patch
       ] ++ lib.optional stdenv.isLinux ./patches/socketdir-in-run.patch;
 
     installTargets = [ "install-world" ];
diff --git a/pkgs/servers/sql/postgresql/patches/findstring.patch b/pkgs/servers/sql/postgresql/patches/findstring.patch
new file mode 100644
index 000000000000..959bf6a6caa4
--- /dev/null
+++ b/pkgs/servers/sql/postgresql/patches/findstring.patch
@@ -0,0 +1,59 @@
+From: Matthew Bauer <mjbauer95@gmail.com>
+Date: Wed, 29 May 2019 22:51:52 -0400
+Subject: [PATCH] Add /postgresql suffix for Nix outputs
+
+Nix outputs put the `name' in each store path like
+/nix/store/...-<name>. This was confusing the Postgres make script
+because it thought its data directory already had postgresql in its
+directory. This lead to Postgres installing all of its fils in
+$out/share. To fix this, we just look for postgres or psql in the part
+after the / using make's notdir.
+
+---
+From: Matthew Bauer <mjbauer95@gmail.com>
+Date: Wed, 29 May 2019 22:51:52 -0400
+Subject: [PATCH] Add /postgresql suffix for Nix outputs
+
+Nix outputs put the `name' in each store path like
+/nix/store/...-<name>. This was confusing the Postgres make script
+because it thought its data directory already had postgresql in its
+directory. This lead to Postgres installing all of its fils in
+$out/share. To fix this, we just look for postgres or psql in the part
+after the / using make's notdir.
+
+---
+diff --git a/src/Makefile.global.in b/src/Makefile.global.in
+index b9d86acaa9..bce05464c3 100644
+--- a/src/Makefile.global.in
++++ b/src/Makefile.global.in
+@@ -102,15 +102,15 @@ datarootdir := @datarootdir@
+ bindir := @bindir@
+ 
+ datadir := @datadir@
+-ifeq "$(findstring pgsql, $(datadir))" ""
+-ifeq "$(findstring postgres, $(datadir))" ""
++ifeq "$(findstring pgsql, $(notdir $(datadir)))" ""
++ifeq "$(findstring postgres, $(notdir $(datadir)))" ""
+ override datadir := $(datadir)/postgresql
+ endif
+ endif
+ 
+ sysconfdir := @sysconfdir@
+-ifeq "$(findstring pgsql, $(sysconfdir))" ""
+-ifeq "$(findstring postgres, $(sysconfdir))" ""
++ifeq "$(findstring pgsql, $(notdir $(sysconfdir)))" ""
++ifeq "$(findstring postgres, $(notdir $(sysconfdir)))" ""
+ override sysconfdir := $(sysconfdir)/postgresql
+ endif
+ endif
+@@ -136,8 +136,8 @@ endif
+ mandir := @mandir@
+ 
+ docdir := @docdir@
+-ifeq "$(findstring pgsql, $(docdir))" ""
+-ifeq "$(findstring postgres, $(docdir))" ""
++ifeq "$(findstring pgsql, $(notdir $(docdir)))" ""
++ifeq "$(findstring postgres, $(notdir $(docdir)))" ""
+ override docdir := $(docdir)/postgresql
+ endif
+ endif