1 { lib, stdenv, fetchFromGitHub, nixosTests, which
3 , withPython3 ? true, python3, ncurses
4 , withPHP81 ? true, php81
5 , withPHP82 ? false, php82
6 , withPerl536 ? false, perl536
7 , withPerl538 ? true, perl538
8 , withRuby_3_1 ? true, ruby_3_1
9 , withRuby_3_2 ? false, ruby_3_2
10 , withSSL ? true, openssl ? null
21 systemdSupport = false;
22 phpdbgSupport = false;
27 php81-unit = php81.override phpConfig;
28 php82-unit = php82.override phpConfig;
30 in stdenv.mkDerivation rec {
34 src = fetchFromGitHub {
38 sha256 = "sha256-YqejETJTbnmXoPsYITJ6hSnd1fIWUc1p5FldYkw2HQI=";
41 nativeBuildInputs = [ which ];
43 buildInputs = [ pcre2.dev ]
44 ++ optionals withPython3 [ python3 ncurses ]
45 ++ optional withPHP81 php81-unit
46 ++ optional withPHP82 php82-unit
47 ++ optional withPerl536 perl536
48 ++ optional withPerl538 perl538
49 ++ optional withRuby_3_1 ruby_3_1
50 ++ optional withRuby_3_2 ruby_3_2
51 ++ optional withSSL openssl;
54 "--control=unix:/run/unit/control.unit.sock"
55 "--pid=/run/unit/unit.pid"
58 ] ++ optional withSSL "--openssl"
59 ++ optional (!withIPv6) "--no-ipv6"
60 ++ optional withDebug "--debug";
62 # Optionally add the PHP derivations used so they can be addressed in the configs
63 usedPhp81 = optionals withPHP81 php81-unit;
66 ${optionalString withPython3 "./configure python --module=python3 --config=python3-config --lib-path=${python3}/lib"}
67 ${optionalString withPHP81 "./configure php --module=php81 --config=${php81-unit.unwrapped.dev}/bin/php-config --lib-path=${php81-unit}/lib"}
68 ${optionalString withPHP82 "./configure php --module=php81 --config=${php82-unit.unwrapped.dev}/bin/php-config --lib-path=${php82-unit}/lib"}
69 ${optionalString withPerl536 "./configure perl --module=perl536 --perl=${perl536}/bin/perl"}
70 ${optionalString withPerl538 "./configure perl --module=perl538 --perl=${perl538}/bin/perl"}
71 ${optionalString withRuby_3_1 "./configure ruby --module=ruby31 --ruby=${ruby_3_1}/bin/ruby"}
72 ${optionalString withRuby_3_2 "./configure ruby --module=ruby32 --ruby=${ruby_3_2}/bin/ruby"}
75 passthru.tests.unit-php = nixosTests.unit-php;
78 description = "Dynamic web and application server, designed to run applications in multiple languages";
79 mainProgram = "unitd";
80 homepage = "https://unit.nginx.org/";
81 license = licenses.asl20;
82 platforms = platforms.linux;
83 maintainers = with maintainers; [ izorkin ];