diff --git a/config/endpoints.nix b/config/endpoints.nix index b59b16f..082f336 100644 --- a/config/endpoints.nix +++ b/config/endpoints.nix @@ -1,91 +1,7 @@ let - net = import ./network.nix; - services = import ./services.nix; - web = import ../intermediate/web.nix; + local = import ./endpoints/local.nix; + web = import ./endpoints/web.nix; + matrix = import ./endpoints/matrix.nix; + vikunja = import ./endpoints/vikunja.nix; in -[ - { - type = "web"; - domain = net.devices.remote_proxy.domain; - endpoint = "/"; - force_ssl = true; - port = 443; - content = web.storePayloads.home; - } - { - type = "proxy"; - domain = net.devices.remote_proxy.domain; - endpoint = "/_matrix/"; - force_ssl = true; - port = 443; - content = { - type = "service"; - ip = net.devices.pi.ip; - port = services.continuwuity.port; - proxyWebsockets = true; - }; - } - { - type = "proxy"; - domain = net.devices.remote_proxy.domain; - endpoint = "/_matrix/"; - force_ssl = true; - port = 8448; - content = { - type = "service"; - ip = net.devices.pi.ip; - port = services.continuwuity.port; - proxyWebsockets = true; - }; - } - { - type = "inline"; - domain = net.devices.remote_proxy.domain; - endpoint = "/.well-known/matrix/server"; - force_ssl = true; - port = 443; - content = { - contentType = "application/json"; - status = 200; - body = ''{"m.server":"${net.devices.remote_proxy.domain}:443"}''; - }; - } - { - type = "inline"; - domain = net.devices.remote_proxy.domain; - endpoint = "/.well-known/matrix/client"; - force_ssl = true; - port = 443; - content = { - contentType = "application/json"; - status = 200; - body = ''{"m.homeserver":{"base_url":"https://${net.devices.remote_proxy.domain}"}}''; - }; - } - { - type = "proxy"; - domain = "torrent.${net.local_domain}"; - endpoint = "/"; - force_ssl = false; - port = 80; - content = { - type = "service"; - ip = net.devices.pi.ip; - port = services.qbittorrent.port; - proxyWebsockets = false; - }; - } - { - type = "proxy"; - domain = "wiki.${net.local_domain}"; - endpoint = "/"; - force_ssl = false; - port = 80; - content = { - type = "service"; - ip = net.devices.pi.ip; - port = services.kiwix.port; - proxyWebsockets = true; - }; - } -] \ No newline at end of file +local ++ web ++ matrix ++ vikunja ++ [] \ No newline at end of file diff --git a/config/endpoints/local.nix b/config/endpoints/local.nix new file mode 100644 index 0000000..2cf5782 --- /dev/null +++ b/config/endpoints/local.nix @@ -0,0 +1,32 @@ +let + net = import ../network.nix; + services = import ../services.nix; +in +[ + { + type = "proxy"; + domain = "torrent.${net.local_domain}"; + endpoint = "/"; + force_ssl = false; + port = 80; + content = { + type = "service"; + ip = net.devices.pi.ip; + port = services.qbittorrent.port; + proxyWebsockets = false; + }; + } + { + type = "proxy"; + domain = "wiki.${net.local_domain}"; + endpoint = "/"; + force_ssl = false; + port = 80; + content = { + type = "service"; + ip = net.devices.pi.ip; + port = services.kiwix.port; + proxyWebsockets = true; + }; + } +] \ No newline at end of file diff --git a/config/endpoints/matrix.nix b/config/endpoints/matrix.nix new file mode 100644 index 0000000..fa6ffc6 --- /dev/null +++ b/config/endpoints/matrix.nix @@ -0,0 +1,56 @@ +let + net = import ../network.nix; + services = import ../services.nix; +in +[ + { + type = "proxy"; + domain = net.devices.remote_proxy.domain; + endpoint = "/_matrix/"; + force_ssl = true; + port = 443; + content = { + type = "service"; + ip = net.devices.pi.ip; + port = services.continuwuity.port; + proxyWebsockets = true; + }; + } + { + type = "proxy"; + domain = net.devices.remote_proxy.domain; + endpoint = "/_matrix/"; + force_ssl = true; + port = 8448; + content = { + type = "service"; + ip = net.devices.pi.ip; + port = services.continuwuity.port; + proxyWebsockets = true; + }; + } + { + type = "inline"; + domain = net.devices.remote_proxy.domain; + endpoint = "/.well-known/matrix/server"; + force_ssl = true; + port = 443; + content = { + contentType = "application/json"; + status = 200; + body = ''{"m.server":"${net.devices.remote_proxy.domain}:443"}''; + }; + } + { + type = "inline"; + domain = net.devices.remote_proxy.domain; + endpoint = "/.well-known/matrix/client"; + force_ssl = true; + port = 443; + content = { + contentType = "application/json"; + status = 200; + body = ''{"m.homeserver":{"base_url":"https://${net.devices.remote_proxy.domain}"}}''; + }; + } +] \ No newline at end of file diff --git a/config/endpoints/vikunja.nix b/config/endpoints/vikunja.nix new file mode 100644 index 0000000..0212f71 --- /dev/null +++ b/config/endpoints/vikunja.nix @@ -0,0 +1,19 @@ +let + net = import ../network.nix; + services = import ../services.nix; +in +[ + { + type = "proxy"; + domain = "vikunja.${net.devices.remote_proxy.domain}"; + endpoint = "/"; + force_ssl = true; + port = 443; + content = { + type = "service"; + ip = net.devices.pi.ip; + port = services.vikunja.port; + proxyWebsockets = true; + }; + } +] \ No newline at end of file diff --git a/config/endpoints/web.nix b/config/endpoints/web.nix new file mode 100644 index 0000000..369bf7c --- /dev/null +++ b/config/endpoints/web.nix @@ -0,0 +1,14 @@ +let + net = import ../network.nix; + web = import ../../intermediate/web.nix; +in +[ + { + type = "web"; + domain = net.devices.remote_proxy.domain; + endpoint = "/"; + force_ssl = true; + port = 443; + content = web.storePayloads.home; + } +] \ No newline at end of file diff --git a/config/services.nix b/config/services.nix index ae13d08..d037e6b 100644 --- a/config/services.nix +++ b/config/services.nix @@ -29,4 +29,8 @@ rec { trusted_servers = [ "matrix.org" ]; }; + vikunja = { + port = 8081; + }; + } diff --git a/services/default.nix b/services/default.nix index fc8cc5b..2a9afba 100644 --- a/services/default.nix +++ b/services/default.nix @@ -9,5 +9,6 @@ ./unbound.nix ./autossh.nix ./continuwuity.nix + ./vikunja.nix ]; } diff --git a/services/vikunja.nix b/services/vikunja.nix new file mode 100644 index 0000000..e9c8fa2 --- /dev/null +++ b/services/vikunja.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: + +let + net = import ../config/network.nix; + services = import ../config/services.nix; +in +{ + services.vikunja = { + enable = true; + frontendHostname = "vikunja.${net.local_domain}"; + frontendScheme = "http"; + port = services.vikunja.port; + }; +}