diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2016-09-28 21:24:42 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2016-09-28 21:24:42 +0300 |
commit | 1af9e6589bdd18e6ba7eeabf073aa7d710020cdd (patch) | |
tree | 698d44e6e8edc191ad720e8f2f7b551525d22082 | |
parent | 5bda7529a87d6cf9b5a68ba85c87263e405627c3 (diff) | |
download | nixsap-1af9e6589bdd18e6ba7eeabf073aa7d710020cdd.tar.gz |
nginx: include instead of inline
To make it vim-, grep- and find-friendly
-rw-r--r-- | apps/nginx.nix | 18 |
1 files 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)} } ''; |