Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 104 lines 2.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 nixosTests, 6 which, 7 pcre2, 8 withPython3 ? true, 9 python3, 10 ncurses, 11 withPHP81 ? true, 12 php81, 13 withPHP82 ? false, 14 php82, 15 withPerl ? true, 16 perl, 17 withRuby_3_1 ? true, 18 ruby_3_1, 19 withRuby_3_2 ? false, 20 ruby_3_2, 21 withSSL ? true, 22 openssl ? null, 23 withIPv6 ? true, 24 withDebug ? false, 25}: 26 27let 28 phpConfig = { 29 embedSupport = true; 30 apxs2Support = false; 31 systemdSupport = false; 32 phpdbgSupport = false; 33 cgiSupport = false; 34 fpmSupport = false; 35 }; 36 37 php81-unit = php81.override phpConfig; 38 php82-unit = php82.override phpConfig; 39 40 inherit (lib) optional optionals optionalString; 41in 42stdenv.mkDerivation rec { 43 version = "1.34.2"; 44 pname = "unit"; 45 46 src = fetchFromGitHub { 47 owner = "nginx"; 48 repo = "unit"; 49 rev = version; 50 sha256 = "sha256-tu1JqGWtfTznTDmZqEEVF3FmiDEXvaAdgQPsvLHCWy8="; 51 }; 52 53 nativeBuildInputs = [ which ]; 54 55 buildInputs = [ 56 pcre2.dev 57 ] 58 ++ optionals withPython3 [ 59 python3 60 ncurses 61 ] 62 ++ optional withPHP81 php81-unit 63 ++ optional withPHP82 php82-unit 64 ++ optional withPerl perl 65 ++ optional withRuby_3_1 ruby_3_1 66 ++ optional withRuby_3_2 ruby_3_2 67 ++ optional withSSL openssl; 68 69 configureFlags = [ 70 "--control=unix:/run/unit/control.unit.sock" 71 "--pid=/run/unit/unit.pid" 72 "--user=unit" 73 "--group=unit" 74 ] 75 ++ optional withSSL "--openssl" 76 ++ optional (!withIPv6) "--no-ipv6" 77 ++ optional withDebug "--debug"; 78 79 # Optionally add the PHP derivations used so they can be addressed in the configs 80 usedPhp81 = optionals withPHP81 php81-unit; 81 82 postConfigure = '' 83 ${optionalString withPython3 "./configure python --module=python3 --config=python3-config --lib-path=${python3}/lib"} 84 ${optionalString withPHP81 "./configure php --module=php81 --config=${php81-unit.unwrapped.dev}/bin/php-config --lib-path=${php81-unit}/lib"} 85 ${optionalString withPHP82 "./configure php --module=php82 --config=${php82-unit.unwrapped.dev}/bin/php-config --lib-path=${php82-unit}/lib"} 86 ${optionalString withPerl "./configure perl --module=perl --perl=${perl}/bin/perl"} 87 ${optionalString withRuby_3_1 "./configure ruby --module=ruby31 --ruby=${ruby_3_1}/bin/ruby"} 88 ${optionalString withRuby_3_2 "./configure ruby --module=ruby32 --ruby=${ruby_3_2}/bin/ruby"} 89 ''; 90 91 passthru.tests = { 92 unit-perl = nixosTests.unit-perl; 93 unit-php = nixosTests.unit-php; 94 }; 95 96 meta = with lib; { 97 description = "Dynamic web and application server, designed to run applications in multiple languages"; 98 mainProgram = "unitd"; 99 homepage = "https://unit.nginx.org/"; 100 license = licenses.asl20; 101 platforms = platforms.linux; 102 maintainers = with maintainers; [ izorkin ]; 103 }; 104}