summary refs log tree commit diff
path: root/pkgs/servers/uwsgi/default.nix
diff options
context:
space:
mode:
authorДамјан Георгиевски <gdamjan@gmail.com>2020-09-09 12:51:40 +0200
committerДамјан Георгиевски <gdamjan@gmail.com>2020-12-22 14:12:15 +0100
commit87bed6c86aa9abb434b18d4e5e4aa47133eac666 (patch)
treef61b58c448f41c430df976105649b01f7c2869bf /pkgs/servers/uwsgi/default.nix
parent6dd858dc300d0f185ca916d90d862927c7bd07cb (diff)
downloadnixpkgs-87bed6c86aa9abb434b18d4e5e4aa47133eac666.tar
nixpkgs-87bed6c86aa9abb434b18d4e5e4aa47133eac666.tar.gz
nixpkgs-87bed6c86aa9abb434b18d4e5e4aa47133eac666.tar.bz2
nixpkgs-87bed6c86aa9abb434b18d4e5e4aa47133eac666.tar.lz
nixpkgs-87bed6c86aa9abb434b18d4e5e4aa47133eac666.tar.xz
nixpkgs-87bed6c86aa9abb434b18d4e5e4aa47133eac666.tar.zst
nixpkgs-87bed6c86aa9abb434b18d4e5e4aa47133eac666.zip
uwsgi: the php plugin needs to link with session.so
On NixOS the session.so php extension is a separate package (and not builtin
in libphp.so). But since the uwsgi php plugin uses the session
mechanisms, we need to link the plugin to that library too.

With this change uwsgipluginpy is hacked to take an additional UWSGICONFIG_PHP_LDFLAGS
environment variable and add it to its LDFLAGS, and then in the nix
expression the UWSGICONFIG_PHP_LDFLAGS is set to point to php.extensions.session
Diffstat (limited to 'pkgs/servers/uwsgi/default.nix')
-rw-r--r--pkgs/servers/uwsgi/default.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/pkgs/servers/uwsgi/default.nix b/pkgs/servers/uwsgi/default.nix
index bb2742ecba8..17d430a82ef 100644
--- a/pkgs/servers/uwsgi/default.nix
+++ b/pkgs/servers/uwsgi/default.nix
@@ -65,7 +65,10 @@ stdenv.mkDerivation rec {
     sha256 = "0256v72b7zr6ds4srpaawk1px3bp0djdwm239w3wrxpw7dzk1gjn";
   };
 
-  patches = [ ./0001-no-ext-session-php_session.h-on-NixOS.patch ];
+  patches = [
+        ./no-ext-session-php_session.h-on-NixOS.patch
+        ./additional-php-ldflags.patch
+  ];
 
   nativeBuildInputs = [ python3 pkgconfig ];
 
@@ -89,6 +92,16 @@ stdenv.mkDerivation rec {
     substituteAll ${./nixos.ini} buildconf/nixos.ini
   '';
 
+  # this is a hack to make the php plugin link with session.so (which on nixos is a separate package)
+  # the hack works in coordination with ./additional-php-ldflags.patch
+  UWSGICONFIG_PHP_LDFLAGS = lib.optionalString (builtins.any (x: x.name == "php") needed)
+        (lib.concatStringsSep "," [
+            "-Wl"
+            "-rpath=${php-embed.extensions.session}/lib/php/extensions/"
+            "--library-path=${php-embed.extensions.session}/lib/php/extensions/"
+            "-l:session.so"
+        ]);
+
   buildPhase = ''
     mkdir -p $pluginDir
     python3 uwsgiconfig.py --build nixos