nixpkgs/pkgs/servers/http/unit/default.nix

92 lines
3.2 KiB
Nix
Raw Normal View History

2021-01-15 08:07:56 +01:00
{ lib, stdenv, fetchFromGitHub, nixosTests, which
2020-11-20 08:33:42 +01:00
, pcre2
2019-11-18 07:39:09 +01:00
, withPython2 ? false, python2
, withPython3 ? true, python3, ncurses
2021-06-03 19:17:27 +02:00
, withPHP74 ? false, php74
, withPHP80 ? true, php80
, withPerl532 ? false, perl532
, withPerl534 ? true, perl534
2018-12-14 19:34:43 +01:00
, withPerldevel ? false, perldevel
2019-11-18 07:39:09 +01:00
, withRuby_2_6 ? true, ruby_2_6
2020-08-15 10:08:22 +02:00
, withRuby_2_7 ? false, ruby_2_7
2018-12-06 11:08:40 +01:00
, withSSL ? true, openssl ? null
, withIPv6 ? true
, withDebug ? false
}:
2021-01-15 08:07:56 +01:00
with lib;
2018-12-06 11:08:40 +01:00
2020-03-22 19:44:55 +01:00
let
phpConfig = {
embedSupport = true;
apxs2Support = false;
systemdSupport = false;
phpdbgSupport = false;
cgiSupport = false;
fpmSupport = false;
2020-03-22 19:44:55 +01:00
};
2020-04-16 21:54:57 +02:00
php74-unit = php74.override phpConfig;
2021-06-03 19:17:27 +02:00
php80-unit = php80.override phpConfig;
2020-04-16 21:54:57 +02:00
2020-03-22 19:44:55 +01:00
in stdenv.mkDerivation rec {
2021-08-22 03:52:23 +02:00
version = "1.25.0";
pname = "unit";
2018-12-06 11:08:40 +01:00
2018-12-14 19:34:43 +01:00
src = fetchFromGitHub {
owner = "nginx";
2020-11-20 08:33:42 +01:00
repo = pname;
2019-09-09 01:38:31 +02:00
rev = version;
2021-08-22 03:52:23 +02:00
sha256 = "sha256-8Xv7YTvwuI0evBO1Te4oI1IoJ0AnK8OVZoZTYtfYKfw=";
2018-12-06 11:08:40 +01:00
};
2018-12-14 19:34:43 +01:00
nativeBuildInputs = [ which ];
2020-11-20 08:33:42 +01:00
buildInputs = [ pcre2.dev ]
2019-11-18 07:39:09 +01:00
++ optional withPython2 python2
++ optionals withPython3 [ python3 ncurses ]
2020-05-30 18:28:25 +02:00
++ optional withPHP74 php74-unit
2021-06-03 19:17:27 +02:00
++ optional withPHP80 php80-unit
++ optional withPerl532 perl532
++ optional withPerl534 perl534
2018-12-14 19:34:43 +01:00
++ optional withPerldevel perldevel
2019-11-18 07:39:09 +01:00
++ optional withRuby_2_6 ruby_2_6
2020-01-01 01:24:48 +01:00
++ optional withRuby_2_7 ruby_2_7
2018-12-14 19:34:43 +01:00
++ optional withSSL openssl;
2018-12-06 11:08:40 +01:00
configureFlags = [
2019-02-25 15:08:01 +01:00
"--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";
2018-12-06 11:08:40 +01:00
# Optionally add the PHP derivations used so they can be addressed in the configs
usedPhp74 = optionals withPHP74 php74-unit;
2021-06-03 19:17:27 +02:00
usedPhp80 = optionals withPHP80 php80-unit;
2018-12-06 11:08:40 +01:00
postConfigure = ''
2020-05-30 18:28:25 +02:00
${optionalString withPython2 "./configure python --module=python2 --config=python2-config --lib-path=${python2}/lib"}
${optionalString withPython3 "./configure python --module=python3 --config=python3-config --lib-path=${python3}/lib"}
2020-04-16 21:54:57 +02:00
${optionalString withPHP74 "./configure php --module=php74 --config=${php74-unit.unwrapped.dev}/bin/php-config --lib-path=${php74-unit}/lib"}
2021-06-03 19:17:27 +02:00
${optionalString withPHP80 "./configure php --module=php80 --config=${php80-unit.unwrapped.dev}/bin/php-config --lib-path=${php80-unit}/lib"}
${optionalString withPerl532 "./configure perl --module=perl532 --perl=${perl532}/bin/perl"}
${optionalString withPerl534 "./configure perl --module=perl534 --perl=${perl534}/bin/perl"}
2019-11-18 07:39:09 +01:00
${optionalString withPerldevel "./configure perl --module=perldev --perl=${perldevel}/bin/perl"}
${optionalString withRuby_2_6 "./configure ruby --module=ruby26 --ruby=${ruby_2_6}/bin/ruby"}
2020-01-01 01:24:48 +01:00
${optionalString withRuby_2_7 "./configure ruby --module=ruby27 --ruby=${ruby_2_7}/bin/ruby"}
2018-12-06 11:08:40 +01:00
'';
2020-04-16 22:08:00 +02:00
passthru.tests.unit-php = nixosTests.unit-php;
2018-12-06 11:08:40 +01:00
meta = {
description = "Dynamic web and application server, designed to run applications in multiple languages";
homepage = "https://unit.nginx.org/";
2018-12-06 11:08:40 +01:00
license = licenses.asl20;
platforms = platforms.linux;
maintainers = with maintainers; [ izorkin ];
};
}