diff options
Diffstat (limited to 'pkgs/servers/uwsgi/default.nix')
-rw-r--r-- | pkgs/servers/uwsgi/default.nix | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/pkgs/servers/uwsgi/default.nix b/pkgs/servers/uwsgi/default.nix index 39a3113eb410..d9ed810cdf49 100644 --- a/pkgs/servers/uwsgi/default.nix +++ b/pkgs/servers/uwsgi/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl, pkgconfig, jansson, pcre +{ stdenv, nixosTests, lib, fetchurl, pkgconfig, jansson, pcre # plugins: list of strings, eg. [ "python2" "python3" ] , plugins ? [] , pam, withPAM ? stdenv.isLinux @@ -38,8 +38,12 @@ let php-embed = php.override { (lib.nameValuePair "php" { # usage: https://uwsgi-docs.readthedocs.io/en/latest/PHP.html#running-php-apps-with-nginx path = "plugins/php"; - inputs = [ php-embed ] ++ php-embed.buildInputs; - NIX_CFLAGS_LINK = [ "-L${libmysqlclient}/lib/mysql" ]; + inputs = [ + php-embed + php-embed.extensions.session + php-embed.extensions.session.dev + php-embed.unwrapped.dev + ] ++ php-embed.unwrapped.buildInputs; }) ]; @@ -61,6 +65,11 @@ stdenv.mkDerivation rec { sha256 = "0256v72b7zr6ds4srpaawk1px3bp0djdwm239w3wrxpw7dzk1gjn"; }; + patches = [ + ./no-ext-session-php_session.h-on-NixOS.patch + ./additional-php-ldflags.patch + ]; + nativeBuildInputs = [ python3 pkgconfig ]; buildInputs = [ jansson pcre ] @@ -83,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 @@ -94,8 +113,6 @@ stdenv.mkDerivation rec { ${lib.concatMapStringsSep "\n" (x: x.install or "") needed} ''; - NIX_CFLAGS_LINK = toString (lib.optional withSystemd "-lsystemd" ++ lib.concatMap (x: x.NIX_CFLAGS_LINK or []) needed); - meta = with stdenv.lib; { homepage = "https://uwsgi-docs.readthedocs.org/en/latest/"; description = "A fast, self-healing and developer/sysadmin-friendly application container server coded in pure C"; @@ -103,4 +120,7 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ abbradar schneefux globin ]; platforms = platforms.unix; }; + + passthru.tests.uwsgi = nixosTests.uwsgi; + } |