diff options
| author | seth <[email protected]> | 2023-08-24 03:57:22 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-08-24 04:21:43 -0400 |
| commit | 0ead9592dc3b6b8ac19b74cdc4980eef15ed78c5 (patch) | |
| tree | 5e7b5974f97436130a9230c34f4ee2b3d2521198 /hosts | |
| parent | 7cbaaa0445e7c49818acf6a30c8bd8e0a62d21c6 (diff) | |
lib/mkProxy+mkVHosts: init
Diffstat (limited to 'hosts')
| -rw-r--r-- | hosts/atlas/nginx.nix | 34 | ||||
| -rw-r--r-- | hosts/p-body/nginx.nix | 34 |
2 files changed, 16 insertions, 52 deletions
diff --git a/hosts/atlas/nginx.nix b/hosts/atlas/nginx.nix index fa06dc3..cdf483d 100644 --- a/hosts/atlas/nginx.nix +++ b/hosts/atlas/nginx.nix @@ -1,9 +1,10 @@ { config, - lib, + self, ... }: let inherit (config.networking) domain; + inherit (self.lib.utils.nginx) mkVHosts mkProxy; in { server = { acme.enable = true; @@ -18,33 +19,14 @@ in { recommendedProxySettings = true; recommendedTlsSettings = true; - virtualHosts = let - mkProxy = endpoint: port: { - "${endpoint}" = { - proxyPass = "http://localhost:${port}"; - proxyWebsockets = true; - }; + virtualHosts = mkVHosts { + "miniflux.${domain}" = { + locations = mkProxy "/" "7000"; }; - mkVHosts = let - commonSettings = { - enableACME = true; - # workaround for https://github.com/NixOS/nixpkgs/issues/210807 - acmeRoot = null; - - addSSL = true; - }; - in - builtins.mapAttrs (_: lib.recursiveUpdate commonSettings); - in - mkVHosts { - "miniflux.${domain}" = { - locations = mkProxy "/" "7000"; - }; - - "msix.${domain}" = { - root = "/var/www/msix"; - }; + "msix.${domain}" = { + root = "/var/www/msix"; }; + }; }; } diff --git a/hosts/p-body/nginx.nix b/hosts/p-body/nginx.nix index d413b5d..d52473c 100644 --- a/hosts/p-body/nginx.nix +++ b/hosts/p-body/nginx.nix @@ -1,9 +1,10 @@ { config, - lib, + self, ... }: let inherit (config.networking) domain; + inherit (self.lib.utils.nginx) mkProxy mkVHosts; in { server = { acme.enable = true; @@ -18,33 +19,14 @@ in { recommendedProxySettings = true; recommendedTlsSettings = true; - virtualHosts = let - mkProxy = endpoint: port: { - "${endpoint}" = { - proxyPass = "http://localhost:${port}"; - proxyWebsockets = true; - }; + virtualHosts = mkVHosts { + "api.${domain}" = { + locations = mkProxy "/" "8080"; }; - mkVHosts = let - commonSettings = { - enableACME = true; - # workaround for https://github.com/NixOS/nixpkgs/issues/210807 - acmeRoot = null; - - addSSL = true; - }; - in - builtins.mapAttrs (_: lib.recursiveUpdate commonSettings); - in - mkVHosts { - "api.${domain}" = { - locations = mkProxy "/" "8080"; - }; - - "grafana.${domain}" = { - locations = mkProxy "/" "4000"; - }; + "grafana.${domain}" = { + locations = mkProxy "/" "4000"; }; + }; }; } |
