From 922e47c83c38c1869a1fdcb737692817d77b63bb Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sat, 28 Oct 2023 05:12:43 +0530 Subject: [PATCH] refactor: adtya.xyz --- hosts/rico2/services/adtya.xyz.nix | 67 +++++++++++++++++++++--------- hosts/rico2/services/frpc.nix | 24 ----------- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/hosts/rico2/services/adtya.xyz.nix b/hosts/rico2/services/adtya.xyz.nix index 18979d1..4330d90 100644 --- a/hosts/rico2/services/adtya.xyz.nix +++ b/hosts/rico2/services/adtya.xyz.nix @@ -3,27 +3,54 @@ adtya-xyz, ... }: { - services.caddy.virtualHosts."adtya.xyz" = { - serverAliases = ["www.adtya.xyz"]; - extraConfig = '' - handle /.well-known/matrix/server { - header Content-Type application/json - header Access-Control-Allow-Origin * - respond `{"m.server": "matrix.adtya.xyz:443"}` - } + services = { + caddy.virtualHosts."adtya.xyz" = { + serverAliases = ["www.adtya.xyz"]; + extraConfig = '' + handle /.well-known/matrix/server { + header Content-Type application/json + header Access-Control-Allow-Origin * + respond `{"m.server": "matrix.adtya.xyz:443"}` + } - handle /.well-known/matrix/client { - header Content-Type application/json - header Access-Control-Allow-Origin * - respond `{"m.homeserver": {"base_url": "https://matrix.adtya.xyz:443"}}` - } + handle /.well-known/matrix/client { + header Content-Type application/json + header Access-Control-Allow-Origin * + respond `{"m.homeserver": {"base_url": "https://matrix.adtya.xyz:443"}}` + } - handle { - root * ${adtya-xyz.packages.${config.nixpkgs.system}.default}/share/web - encode gzip - try_files {path} /index.html - file_server - } - ''; + handle { + root * ${adtya-xyz.packages.${config.nixpkgs.system}.default}/share/web + encode gzip + try_files {path} /index.html + file_server + } + ''; + }; + frp.settings = { + "http.adtya.xyz" = { + type = "http"; + custom_domains = "adtya.xyz"; + local_port = 80; + }; + + "https.adtya.xyz" = { + type = "https"; + custom_domains = "adtya.xyz"; + local_port = 443; + }; + + "http.www.adtya.xyz" = { + type = "http"; + custom_domains = "www.adtya.xyz"; + local_port = 80; + }; + + "https.www.adtya.xyz" = { + type = "https"; + custom_domains = "www.adtya.xyz"; + local_port = 443; + }; + }; }; } diff --git a/hosts/rico2/services/frpc.nix b/hosts/rico2/services/frpc.nix index 2108b2e..2b4618c 100644 --- a/hosts/rico2/services/frpc.nix +++ b/hosts/rico2/services/frpc.nix @@ -22,30 +22,6 @@ in { remote_port = 6002; }; - "http.adtya.xyz" = { - type = "http"; - custom_domains = "adtya.xyz"; - local_port = 80; - }; - - "https.adtya.xyz" = { - type = "https"; - custom_domains = "adtya.xyz"; - local_port = 443; - }; - - "http.www.adtya.xyz" = { - type = "http"; - custom_domains = "www.adtya.xyz"; - local_port = 80; - }; - - "https.www.adtya.xyz" = { - type = "https"; - custom_domains = "www.adtya.xyz"; - local_port = 443; - }; - "http.if3.adtya.xyz" = { type = "http"; custom_domains = "if3.adtya.xyz";