From 7a51cbb04214a915b57ee91ff3aaad029739d6cd Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Mon, 10 Jun 2024 16:48:35 +0800 Subject: [PATCH] lightsail-tokyo: add forgejo --- hosts/lightsail-tokyo/Caddyfile | 5 ++++ hosts/lightsail-tokyo/default.nix | 42 +++++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/hosts/lightsail-tokyo/Caddyfile b/hosts/lightsail-tokyo/Caddyfile index 925a178..76edaec 100644 --- a/hosts/lightsail-tokyo/Caddyfile +++ b/hosts/lightsail-tokyo/Caddyfile @@ -138,3 +138,8 @@ mastodon.ny4.dev { file_server } } + +git.ny4.dev { + import default + reverse_proxy unix//run/forgejo/forgejo.sock +} diff --git a/hosts/lightsail-tokyo/default.nix b/hosts/lightsail-tokyo/default.nix index 8f524b8..192d87c 100644 --- a/hosts/lightsail-tokyo/default.nix +++ b/hosts/lightsail-tokyo/default.nix @@ -204,30 +204,32 @@ }; }; - services = [ + services = let + getDesc = pkg: pkg.meta.description; + in [ { "Services" = [ { "SearXNG" = { - description = "A privacy-respecting, open metasearch engine."; + description = getDesc pkgs.searxng; href = "https://searx.ny4.dev"; }; } { "Wastebin" = { - description = "A minimal pastebin with a design shamelessly copied from bin."; + description = getDesc pkgs.wastebin; href = "https://pb.ny4.dev"; }; } { "Ntfy" = { - description = "Send push notifications to your phone or desktop using PUT/POST."; + description = getDesc pkgs.ntfy; href = "https://ntfy.ny4.dev/"; }; } { "Mumble" = { - description = "Open Source, Low Latency, High Quality Voice Chat. (Connect with ny4.dev:64738)"; + description = "${getDesc pkgs.mumble} (Connect with ny4.dev:64738)"; }; } ]; @@ -236,7 +238,7 @@ "Private stuff" = [ { "Mastodon" = rec { - description = "Free, open-source decentralized social media platform."; + description = getDesc pkgs.mastodon; href = "https://mastodon.ny4.dev/"; widget.type = "mastodon"; widget.url = href; @@ -244,7 +246,7 @@ } { "Matrix" = { - description = "An open network for secure, decentralised communication."; + description = getDesc pkgs.element-web; href = "https://element.ny4.dev/"; }; } @@ -256,10 +258,16 @@ } { "Uptime Kuma" = { - description = "A fancy self-hosted monitoring tool."; + description = getDesc pkgs.uptime-kuma; href = "https://uptime.ny4.dev/"; }; } + { + "Forgejo" = { + description = getDesc pkgs.forgejo; + href = "https://git.ny4.dev/"; + }; + } ]; } { @@ -268,11 +276,29 @@ {"GitHub".href = "https://github.com/Guanran928";} {"Mastodon".herf = "https://mastodon.ny4.dev/@nyancat";} {"Matrix".href = "https://matrix.to/#/@root:ny4.dev";} + {"Forgejo".href = "https://git.ny4.dev/nyancat";} ]; } ]; }; + services.forgejo = { + enable = true; + database.type = "postgres"; + settings = { + server = { + # TODO: whats the difference between this and fcgi+unix + DOMAIN = "git.ny4.dev"; + PROTOCOL = "http+unix"; + ROOT_URL = "https://git.ny4.dev/"; + }; + + service = { + ALLOW_ONLY_EXTERNAL_REGISTRATION = true; + }; + }; + }; + ### Prevents me from bankrupt # https://fmk.im/p/shutdown-aws/ services.vnstat.enable = true;