1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00
nixpkgs/pkgs/servers/http/unit/default.nix

96 lines
3.2 KiB
Nix
Raw Normal View History

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