@@ -65,7 +65,10 @@ stdenv.mkDerivation rec {
6565 sha256 = "0256v72b7zr6ds4srpaawk1px3bp0djdwm239w3wrxpw7dzk1gjn";
6666 };
6767
68− patches = [ ./0001-no-ext-session-php_session.h-on-NixOS.patch ];
68+ patches = [
69+ ./no-ext-session-php_session.h-on-NixOS.patch
70+ ./additional-php-ldflags.patch
71+ ];
6972
7073 nativeBuildInputs = [ python3 pkgconfig ];
7174
@@ -89,6 +92,16 @@ stdenv.mkDerivation rec {
8992 substituteAll ${./nixos.ini} buildconf/nixos.ini
9093 '';
9194
95+ # this is a hack to make the php plugin link with session.so (which on nixos is a separate package)
96+ # the hack works in coordination with ./additional-php-ldflags.patch
97+ UWSGICONFIG_PHP_LDFLAGS = lib.optionalString (builtins.any (x: x.name == "php") needed)
98+ (lib.concatStringsSep "," [
99+ "-Wl"
100+ "-rpath=${php-embed.extensions.session}/lib/php/extensions/"
101+ "--library-path=${php-embed.extensions.session}/lib/php/extensions/"
102+ "-l:session.so"
103+ ]);
104+
92105 buildPhase = ''
93106 mkdir -p $pluginDir
94107 python3 uwsgiconfig.py --build nixos