nixpkgs/pkgs/by-name/un/unit/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
2.7 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 06:27:57 +00:00
, withPHP81 ? true, php81
2023-04-19 08:36:33 +00:00
, withPHP82 ? false, php82
, withPerl ? true, perl
2023-05-13 08:18:29 +00:00
, withRuby_3_1 ? true, ruby_3_1
2023-05-13 08:19:27 +00:00
, withRuby_3_2 ? false, ruby_3_2
2018-12-06 10:08:40 +00:00
, withSSL ? true, openssl ? null
, withIPv6 ? true
, withDebug ? false
}:
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
};
2022-06-03 06:27:57 +00:00
php81-unit = php81.override phpConfig;
2023-04-19 08:36:33 +00:00
php82-unit = php82.override phpConfig;
2020-04-16 19:54:57 +00:00
2024-05-13 19:52:03 +00:00
inherit (lib) optional optionals optionalString;
2020-03-22 18:44:55 +00:00
in stdenv.mkDerivation rec {
2024-09-17 05:14:16 +00:00
version = "1.33.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-08 23:38:31 +00:00
rev = version;
2024-09-17 05:14:16 +00:00
sha256 = "sha256-Q3RXhWI9+G7oUnHYtVK6WZ9s7eIkQ+yPmdqbjWyatTE=";
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 ]
2022-06-03 06:27:57 +00:00
++ optional withPHP81 php81-unit
2023-04-19 08:36:33 +00:00
++ optional withPHP82 php82-unit
++ optional withPerl perl
2022-06-03 06:48:26 +00:00
++ optional withRuby_3_1 ruby_3_1
2023-05-13 08:19:27 +00:00
++ optional withRuby_3_2 ruby_3_2
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
2022-06-03 06:27:57 +00:00
usedPhp81 = optionals withPHP81 php81-unit;
2018-12-06 10:08:40 +00:00
postConfigure = ''
2020-05-30 16:28:25 +00:00
${optionalString withPython3 "./configure python --module=python3 --config=python3-config --lib-path=${python3}/lib"}
2022-06-03 06:27:57 +00:00
${optionalString withPHP81 "./configure php --module=php81 --config=${php81-unit.unwrapped.dev}/bin/php-config --lib-path=${php81-unit}/lib"}
2024-09-19 13:16:07 +00:00
${optionalString withPHP82 "./configure php --module=php82 --config=${php82-unit.unwrapped.dev}/bin/php-config --lib-path=${php82-unit}/lib"}
${optionalString withPerl "./configure perl --module=perl --perl=${perl}/bin/perl"}
2022-06-03 06:48:26 +00:00
${optionalString withRuby_3_1 "./configure ruby --module=ruby31 --ruby=${ruby_3_1}/bin/ruby"}
2023-05-13 08:19:27 +00:00
${optionalString withRuby_3_2 "./configure ruby --module=ruby32 --ruby=${ruby_3_2}/bin/ruby"}
2018-12-06 10:08:40 +00:00
'';
2024-09-08 17:45:16 +00:00
passthru.tests = {
unit-perl = nixosTests.unit-perl;
unit-php = nixosTests.unit-php;
};
2020-04-16 20:08:00 +00:00
2024-05-13 19:52:03 +00:00
meta = with lib; {
description = "Dynamic web and application server, designed to run applications in multiple languages";
mainProgram = "unitd";
homepage = "https://unit.nginx.org/";
2018-12-06 10:08:40 +00:00
license = licenses.asl20;
platforms = platforms.linux;
maintainers = with maintainers; [ izorkin ];
};
}