about summary refs log tree commit diff
path: root/pkgs/servers/http/nginx/modules.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/servers/http/nginx/modules.nix')
-rw-r--r--pkgs/servers/http/nginx/modules.nix144
1 files changed, 90 insertions, 54 deletions
diff --git a/pkgs/servers/http/nginx/modules.nix b/pkgs/servers/http/nginx/modules.nix
index 2eebf84b41eaf..64be47874a40d 100644
--- a/pkgs/servers/http/nginx/modules.nix
+++ b/pkgs/servers/http/nginx/modules.nix
@@ -1,4 +1,35 @@
-{ config, fetchFromGitHub, fetchFromGitLab, fetchhg, lib, pkgs }:
+{ lib
+, config
+, fetchFromGitHub
+, fetchFromGitLab
+, fetchhg
+, fetchpatch
+, runCommand
+
+, arpa2common
+, brotli
+, curl
+, expat
+, fdk_aac
+, ffmpeg
+, geoip
+, libbsd
+, libiconv
+, libmaxminddb
+, libmodsecurity
+, libuuid
+, libxml2
+, lmdb
+, luajit
+, msgpuck
+, openssl
+, opentracing-cpp
+, pam
+, psol
+, which
+, yajl
+, zlib
+}:
 
 let
 
@@ -31,7 +62,7 @@ let self = {
       rev = "34fd0c94d2c43c642f323491c4f4a226cd83b962";
       sha256 = "0yf34s11vgkcl03wbl6gjngm3p9hs8vvm7hkjkwhjh39vkk2a7cy";
     };
-    inputs = [ pkgs.openssl ];
+    inputs = [ openssl ];
   };
 
   auth-a2aclr = {
@@ -44,7 +75,7 @@ let self = {
       sha256 = "sha256-h2LgMhreCgod+H/bNQzY9BvqG9ezkwikwWB3T6gHH04=";
     };
     inputs = [
-      (pkgs.arpa2common.overrideAttrs
+      (arpa2common.overrideAttrs
         (old: rec {
           version = "0.7.1";
 
@@ -71,19 +102,19 @@ let self = {
 
   brotli = {
     name = "brotli";
-    src = let gitsrc = pkgs.fetchFromGitHub {
+    src = let gitsrc = fetchFromGitHub {
       name = "brotli";
       owner = "google";
       repo = "ngx_brotli";
       rev = "25f86f0bac1101b6512135eac5f93c49c63609e3";
       sha256 = "02hfvfa6milj40qc2ikpb9f95sxqvxk4hly3x74kqhysbdi06hhv";
     }; in
-      pkgs.runCommand "ngx_brotli-src" { } ''
+      runCommand "ngx_brotli-src" { } ''
         cp -a ${gitsrc} $out
         substituteInPlace $out/filter/config \
-          --replace '$ngx_addon_dir/deps/brotli/c' ${lib.getDev pkgs.brotli}
+          --replace '$ngx_addon_dir/deps/brotli/c' ${lib.getDev brotli}
       '';
-    inputs = [ pkgs.brotli ];
+    inputs = [ brotli ];
   };
 
   cache-purge = {
@@ -117,7 +148,7 @@ let self = {
       rev = "v3.0.0";
       sha256 = "000dm5zk0m1hm1iq60aff5r6y8xmqd7djrwhgnz9ig01xyhnjv9w";
     };
-    inputs = [ pkgs.expat ];
+    inputs = [ expat ];
   };
 
   develkit = {
@@ -176,7 +207,7 @@ let self = {
       rev = "3.3";
       sha256 = "EEn/qxPsBFgVBqOgPYTrRhaLPwSBlSPWYYSr3SL8wZA=";
     };
-    inputs = [ pkgs.libmaxminddb ];
+    inputs = [ libmaxminddb ];
 
     meta = {
       maintainers = with lib.maintainers; [ pinpox ];
@@ -201,7 +232,7 @@ let self = {
         rev = "v1.0.1";
         sha256 = "0qcx15c8wbsmyz2hkmyy5yd7qn1n84kx9amaxnfxkpqi05vzm1zz";
       } + "/ipscrub";
-    inputs = [ pkgs.libbsd ];
+    inputs = [ libbsd ];
   };
 
   limit-speed = {
@@ -226,19 +257,33 @@ let self = {
     };
   };
 
-  lua = {
+  lua = rec {
     name = "lua";
     src = fetchFromGitHub {
       name = "lua";
       owner = "openresty";
       repo = "lua-nginx-module";
-      rev = "v0.10.15";
-      sha256 = "1j216isp0546hycklbr5wi8mlga5hq170hk7f2sm16sfavlkh5gz";
-    };
-    inputs = [ pkgs.luajit ];
-    preConfigure = ''
-      export LUAJIT_LIB="${pkgs.luajit}/lib"
-      export LUAJIT_INC="${pkgs.luajit}/include/luajit-2.0"
+      rev = "v0.10.22";
+      sha256 = "sha256-TyeTL7/0dI2wS2eACS4sI+9tu7UpDq09aemMaklkUss=";
+    };
+    inputs = [ luajit ];
+    preConfigure = let
+      # fix compilation against nginx 1.23.0
+      nginx-1-23-patch = fetchpatch {
+        url = "https://github.com/openresty/lua-nginx-module/commit/b6d167cf1a93c0c885c28db5a439f2404874cb26.patch";
+        sha256 = "sha256-l7GHFNZXg+RG2SIBjYJO1JHdGUtthWnzLIqEORJUNr4=";
+      };
+    in ''
+      export LUAJIT_LIB="${luajit}/lib"
+      export LUAJIT_INC="$(realpath ${luajit}/include/luajit-*)"
+
+      # make source directory writable to allow generating src/ngx_http_lua_autoconf.h
+      lua_src=$TMPDIR/lua-src
+      cp -r "${src}/" "$lua_src"
+      chmod -R +w "$lua_src"
+      patch -p1 -d $lua_src -i ${nginx-1-23-patch}
+      export configureFlags="''${configureFlags//"${src}"/"$lua_src"}"
+      unset lua_src
     '';
     allowMemoryWriteExecute = true;
   };
@@ -252,7 +297,7 @@ let self = {
       rev = "v0.07";
       sha256 = "1gqccg8airli3i9103zv1zfwbjm27h235qjabfbfqk503rjamkpk";
     };
-    inputs = [ pkgs.luajit ];
+    inputs = [ luajit ];
     allowMemoryWriteExecute = true;
   };
 
@@ -265,7 +310,7 @@ let self = {
       rev = "v1.0.3";
       sha256 = "sha256-xp0/eqi5PJlzb9NaUbNnzEqNcxDPyjyNwZOwmlv1+ag=";
     };
-    inputs = [ pkgs.curl pkgs.geoip pkgs.libmodsecurity pkgs.libxml2 pkgs.lmdb pkgs.yajl ];
+    inputs = [ curl geoip libmodsecurity libxml2 lmdb yajl ];
     disableIPC = true;
   };
 
@@ -322,7 +367,7 @@ let self = {
       unset NJS_SOURCE_DIR
     '';
 
-    inputs = [ pkgs.which ];
+    inputs = [ which ];
   };
 
   opentracing = {
@@ -336,42 +381,33 @@ let self = {
         sha256 = "1q234s3p55xv820207dnh4fcxkqikjcq5rs02ai31ylpmfsf0kkb";
       };
       in "${src'}/opentracing";
-    inputs = [ pkgs.opentracing-cpp ];
+    inputs = [ opentracing-cpp ];
   };
 
-  pagespeed =
-    let
-      version = pkgs.psol.version;
-
+  pagespeed = {
+    name = "pagespeed";
+    src = let
       moduleSrc = fetchFromGitHub {
         name = "pagespeed";
         owner = "pagespeed";
         repo = "ngx_pagespeed";
-        rev = "v${version}-stable";
+        rev = "v${psol.version}-stable";
         sha256 = "0ry7vmkb2bx0sspl1kgjlrzzz6lbz07313ks2lr80rrdm2zb16wp";
       };
-
-      ngx_pagespeed = pkgs.runCommand
-        "ngx_pagespeed"
-        {
-          meta = {
-            description = "PageSpeed module for Nginx";
-            homepage = "https://developers.google.com/speed/pagespeed/module/";
-            license = pkgs.lib.licenses.asl20;
-          };
-        }
-        ''
-          cp -r "${moduleSrc}" "$out"
-          chmod -R +w "$out"
-          ln -s "${pkgs.psol}" "$out/psol"
-        '';
-    in
-    {
-      name = "pagespeed";
-      src = ngx_pagespeed;
-      inputs = [ pkgs.zlib pkgs.libuuid ]; # psol deps
-      allowMemoryWriteExecute = true;
-    };
+    in runCommand "ngx_pagespeed" {
+      meta = {
+        description = "PageSpeed module for Nginx";
+        homepage = "https://developers.google.com/speed/pagespeed/module/";
+        license = lib.licenses.asl20;
+      };
+    } ''
+      cp -r "${moduleSrc}" "$out"
+      chmod -R +w "$out"
+      ln -s "${psol}" "$out/psol"
+    '';
+    inputs = [ zlib libuuid ]; # psol deps
+    allowMemoryWriteExecute = true;
+  };
 
   pam = {
     name = "pam";
@@ -382,7 +418,7 @@ let self = {
       rev = "v1.5.3";
       sha256 = "sha256:09lnljdhjg65643bc4535z378lsn4llbq67zcxlln0pizk9y921a";
     };
-    inputs = [ pkgs.pam ];
+    inputs = [ pam ];
   };
 
   pinba = {
@@ -427,7 +463,7 @@ let self = {
       rev = "95bdc0d1aca06ea7fe42555f71e65910bd74914d";
       sha256 = "19wzck1xzq4kz7nyabcwzlank1k7wi7w2wn2c1mwz374c79g8ggp";
     };
-    inputs = [ pkgs.openssl ];
+    inputs = [ openssl ];
   };
 
   set-misc = {
@@ -582,7 +618,7 @@ let self = {
       rev = "v2.7.1";
       sha256 = "0ya4330in7zjzqw57djv4icpk0n1j98nvf0f8v296yi9rjy054br";
     };
-    inputs = [ pkgs.msgpuck.dev pkgs.yajl ];
+    inputs = [ msgpuck.dev yajl ];
   };
 
   url = {
@@ -605,7 +641,7 @@ let self = {
       rev = "92b80642538eec4cfc98114dec5917b8d820e912";
       sha256 = "0a8d9ifryhhnll7k7jcsf9frshk5yhpsgz7zgxdmw81wbz5hxklc";
     };
-    inputs = [ pkgs.ffmpeg ];
+    inputs = [ ffmpeg ];
   };
 
   vod = {
@@ -617,7 +653,7 @@ let self = {
       rev = "1.29";
       sha256 = "1z0ka0cwqbgh3fv2d5yva395sf90626rdzx7lyfrgs89gy4h9nrr";
     };
-    inputs = with pkgs; [ ffmpeg fdk_aac openssl libxml2 libiconv ];
+    inputs = [ ffmpeg fdk_aac openssl libxml2 libiconv ];
   };
 
   vts = {