summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/nginx.nix13
-rw-r--r--systems/atlas/nginx.nix15
2 files changed, 16 insertions, 12 deletions
diff --git a/lib/nginx.nix b/lib/nginx.nix
new file mode 100644
index 0000000..0328f79
--- /dev/null
+++ b/lib/nginx.nix
@@ -0,0 +1,13 @@
+{lib, ...}: {
+ mkProxy = endpoint: port: {
+ "${endpoint}" = {
+ proxyPass = "http://localhost:${toString port}";
+ proxyWebsockets = true;
+ };
+ };
+
+ toVHosts = domain:
+ lib.mapAttrs' (
+ name: value: lib.nameValuePair "${name}.${domain}" value
+ );
+}
diff --git a/systems/atlas/nginx.nix b/systems/atlas/nginx.nix
index 29c76e8..001c4d5 100644
--- a/systems/atlas/nginx.nix
+++ b/systems/atlas/nginx.nix
@@ -1,21 +1,12 @@
{
config,
- lib,
+ inputs,
...
}: let
- mkProxy = endpoint: port: {
- "${endpoint}" = {
- proxyPass = "http://localhost:${toString port}";
- proxyWebsockets = true;
- };
- };
-
- toVHosts = lib.mapAttrs' (
- name: value: lib.nameValuePair "${name}.${config.networking.domain}" value
- );
+ inherit (inputs.self.lib.nginx) mkProxy toVHosts;
in {
services.nginx = {
- virtualHosts = toVHosts {
+ virtualHosts = toVHosts config.networking.domain {
miniflux = {
locations = mkProxy "/" "7000";
};