From 1af9e6589bdd18e6ba7eeabf073aa7d710020cdd Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Wed, 28 Sep 2016 21:24:42 +0300 Subject: nginx: include instead of inline To make it vim-, grep- and find-friendly --- apps/nginx.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/nginx.nix b/apps/nginx.nix index b9dc4ac..3765d67 100644 --- a/apps/nginx.nix +++ b/apps/nginx.nix @@ -2,11 +2,16 @@ let - inherit (lib) mkIf mkOption mkEnableOption types filterAttrs - mapAttrsToList concatStringsSep; - inherit (types) int bool nullOr attrsOf str either enum submodule lines path; + inherit (builtins) + filter isBool toString ; + + inherit (lib) + concatMapStrings concatStringsSep filterAttrs mapAttrsToList mkEnableOption + mkIf mkOption ; + + inherit (lib.types) + attrsOf bool either enum int lines nullOr path str submodule ; - inherit (builtins) isBool filter toString; cfg = config.nixsap.apps.nginx; explicit = filterAttrs (n: v: n != "_module" && v != null); @@ -21,7 +26,8 @@ let let mkEntry = k: v: "${indent}${k} ${show v};"; in concatStringsSep "\n" (mapAttrsToList mkEntry (explicit set)); - mkServer = name: text: '' + mkServer = name: text: pkgs.writeText "nginx-${name}.conf" '' + # ${name}: server { ${text} } @@ -60,7 +66,7 @@ let fastcgi_param HTTP_PROXY ""; proxy_set_header Proxy ""; - ${concatStringsSep "\n" (mapAttrsToList mkServer cfg.http.servers)} + ${concatMapStrings (s: "include ${s}\n;") (mapAttrsToList mkServer cfg.http.servers)} } ''; -- cgit v1.2.3