about summary refs log tree commit diff
path: root/pkgs/servers/http
diff options
context:
space:
mode:
authorHenri Menke <henri@henrimenke.de>2022-09-18 14:54:04 +0200
committerHenri Menke <henri@henrimenke.de>2022-11-05 21:40:57 +0100
commit9ab02e1ec6e7a9a44a087a8b131e65f77e924c0d (patch)
tree799fe456a078732550eea0b2340bf4d49be72d67 /pkgs/servers/http
parent830a385b5f3f9a03c4f44f08071c655f9d85c2b3 (diff)
nginxModules.njs: init at 0.7.8
Diffstat (limited to 'pkgs/servers/http')
-rw-r--r--pkgs/servers/http/nginx/modules.nix24
1 files changed, 23 insertions, 1 deletions
diff --git a/pkgs/servers/http/nginx/modules.nix b/pkgs/servers/http/nginx/modules.nix
index 09f58becbab4f..7d8a6716bc973 100644
--- a/pkgs/servers/http/nginx/modules.nix
+++ b/pkgs/servers/http/nginx/modules.nix
@@ -1,4 +1,4 @@
-{ fetchFromGitHub, fetchFromGitLab, lib, pkgs }:
+{ fetchFromGitHub, fetchFromGitLab, fetchhg, lib, pkgs }:
 
 let
 
@@ -290,6 +290,28 @@ in
       } + "/naxsi_src";
   };
 
+  njs = rec {
+    src = fetchhg {
+      url = "https://hg.nginx.org/njs";
+      rev = "0.7.8";
+      sha256 = "sha256-jsR8EOeW8tAo2utKznuUaCG4hK0oU0ZJSnnGmI5HUDk=";
+      name = "nginx-njs";
+    };
+
+    # njs module sources have to be writable during nginx build, so we copy them
+    # to a temporary directory and change the module path in the configureFlags
+    preConfigure = ''
+      NJS_SOURCE_DIR=$(readlink -m "$TMPDIR/${src}")
+      mkdir -p "$(dirname "$NJS_SOURCE_DIR")"
+      cp --recursive "${src}" "$NJS_SOURCE_DIR"
+      chmod -R u+rwX,go+rX "$NJS_SOURCE_DIR"
+      export configureFlags="''${configureFlags/"${src}"/"$NJS_SOURCE_DIR/nginx"}"
+      unset NJS_SOURCE_DIR
+    '';
+
+    inputs = [ pkgs.which ];
+  };
+
   opentracing = {
     src =
       let src' = fetchFromGitHub {