2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, nixosTests, which
|
2020-11-30 08:33:03 +00:00
|
|
|
, pcre2
|
2020-04-24 23:36:52 +00:00
|
|
|
, withPython3 ? true, python3, ncurses
|
2022-07-18 16:21:45 +00:00
|
|
|
, withPHP80 ? false, php80
|
|
|
|
, withPHP81 ? true, php81
|
2022-08-21 13:32:41 +00:00
|
|
|
, withPerl534 ? false, perl534
|
|
|
|
, withPerl536 ? true, perl536
|
2020-04-24 23:36:52 +00:00
|
|
|
, withPerldevel ? false, perldevel
|
2022-07-18 16:21:45 +00:00
|
|
|
, withRuby_2_7 ? true, ruby_2_7
|
|
|
|
, withRuby_3_0 ? false, ruby_3_0
|
|
|
|
, withRuby_3_1 ? false, ruby_3_1
|
2020-04-24 23:36:52 +00:00
|
|
|
, withSSL ? true, openssl ? null
|
|
|
|
, withIPv6 ? true
|
|
|
|
, withDebug ? false
|
|
|
|
}:
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
with lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
phpConfig = {
|
2020-05-03 17:38:23 +00:00
|
|
|
embedSupport = true;
|
|
|
|
apxs2Support = false;
|
|
|
|
systemdSupport = false;
|
|
|
|
phpdbgSupport = false;
|
|
|
|
cgiSupport = false;
|
|
|
|
fpmSupport = false;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-06-06 07:54:09 +00:00
|
|
|
php80-unit = php80.override phpConfig;
|
2022-07-18 16:21:45 +00:00
|
|
|
php81-unit = php81.override phpConfig;
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2022-07-18 16:21:45 +00:00
|
|
|
version = "1.27.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "unit";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "nginx";
|
2020-11-30 08:33:03 +00:00
|
|
|
repo = pname;
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = version;
|
2022-07-18 16:21:45 +00:00
|
|
|
sha256 = "sha256-H/WIrCyocEO/HZfVMyI9IwD565JsUIzC8n1qUYmCvWc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ which ];
|
|
|
|
|
2020-11-30 08:33:03 +00:00
|
|
|
buildInputs = [ pcre2.dev ]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ optionals withPython3 [ python3 ncurses ]
|
2021-06-06 07:54:09 +00:00
|
|
|
++ optional withPHP80 php80-unit
|
2022-07-18 16:21:45 +00:00
|
|
|
++ optional withPHP81 php81-unit
|
2021-07-21 07:28:18 +00:00
|
|
|
++ optional withPerl534 perl534
|
2022-08-21 13:32:41 +00:00
|
|
|
++ optional withPerl536 perl536
|
2020-04-24 23:36:52 +00:00
|
|
|
++ optional withPerldevel perldevel
|
|
|
|
++ optional withRuby_2_7 ruby_2_7
|
2022-07-18 16:21:45 +00:00
|
|
|
++ optional withRuby_3_0 ruby_3_0
|
|
|
|
++ optional withRuby_3_1 ruby_3_1
|
2020-04-24 23:36:52 +00:00
|
|
|
++ optional withSSL openssl;
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--control=unix:/run/unit/control.unit.sock"
|
|
|
|
"--pid=/run/unit/unit.pid"
|
|
|
|
"--user=unit"
|
|
|
|
"--group=unit"
|
|
|
|
] ++ optional withSSL "--openssl"
|
|
|
|
++ optional (!withIPv6) "--no-ipv6"
|
|
|
|
++ optional withDebug "--debug";
|
|
|
|
|
2020-06-02 18:00:15 +00:00
|
|
|
# Optionally add the PHP derivations used so they can be addressed in the configs
|
2021-06-06 07:54:09 +00:00
|
|
|
usedPhp80 = optionals withPHP80 php80-unit;
|
2022-07-18 16:21:45 +00:00
|
|
|
usedPhp81 = optionals withPHP81 php81-unit;
|
2020-06-02 18:00:15 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postConfigure = ''
|
2020-06-02 18:00:15 +00:00
|
|
|
${optionalString withPython3 "./configure python --module=python3 --config=python3-config --lib-path=${python3}/lib"}
|
2021-06-06 07:54:09 +00:00
|
|
|
${optionalString withPHP80 "./configure php --module=php80 --config=${php80-unit.unwrapped.dev}/bin/php-config --lib-path=${php80-unit}/lib"}
|
2022-07-18 16:21:45 +00:00
|
|
|
${optionalString withPHP81 "./configure php --module=php81 --config=${php81-unit.unwrapped.dev}/bin/php-config --lib-path=${php81-unit}/lib"}
|
2021-07-21 07:28:18 +00:00
|
|
|
${optionalString withPerl534 "./configure perl --module=perl534 --perl=${perl534}/bin/perl"}
|
2022-08-21 13:32:41 +00:00
|
|
|
${optionalString withPerl536 "./configure perl --module=perl536 --perl=${perl536}/bin/perl"}
|
2020-04-24 23:36:52 +00:00
|
|
|
${optionalString withPerldevel "./configure perl --module=perldev --perl=${perldevel}/bin/perl"}
|
|
|
|
${optionalString withRuby_2_7 "./configure ruby --module=ruby27 --ruby=${ruby_2_7}/bin/ruby"}
|
2022-07-18 16:21:45 +00:00
|
|
|
${optionalString withRuby_3_0 "./configure ruby --module=ruby30 --ruby=${ruby_3_0}/bin/ruby"}
|
|
|
|
${optionalString withRuby_3_1 "./configure ruby --module=ruby31 --ruby=${ruby_3_1}/bin/ruby"}
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
rmdir $out/state
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
passthru.tests.unit-php = nixosTests.unit-php;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
2020-10-19 00:13:06 +00:00
|
|
|
description = "Dynamic web and application server, designed to run applications in multiple languages";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://unit.nginx.org/";
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ izorkin ];
|
|
|
|
};
|
|
|
|
}
|