From dddc557b46054c2440fedeccbd16c6dea3452bf7 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Fri, 28 Oct 2022 13:40:50 +0200 Subject: [PATCH] nginx: Use openresty package. Add openidc plugin. --- hosts/architect/nginx.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hosts/architect/nginx.nix b/hosts/architect/nginx.nix index 0777276..8937587 100644 --- a/hosts/architect/nginx.nix +++ b/hosts/architect/nginx.nix @@ -1,8 +1,9 @@ -{ services, ... }: +{ services, pkgs, lib, ... }: { services.nginx = { enable = true; + package = pkgs.openresty; recommendedGzipSettings = true; recommendedOptimisation = true; recommendedProxySettings = true; @@ -25,6 +26,17 @@ "/wat.jpg" = { }; }; }; + appendHttpConfig = let + extraPureLuaPackages = with pkgs.luajitPackages; [ lua-resty-openidc ]; + luaPath = pkg: "${pkg}/share/lua/5.1/?.lua"; + makeLuaPath = lib.concatMapStringsSep ";" luaPath; + in '' + lua_package_path '${makeLuaPath extraPureLuaPackages};;'; + + # cache for OIDC discovery metadata + lua_shared_dict discovery 1m; + ''; + appendConfig = '' worker_processes 24; '';