From d143dbef2197b434edd730a5d3f8795f96947559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Sat, 6 Apr 2024 16:59:44 -0300 Subject: [PATCH] wip --- flake.lock | 6 +++--- hosts/phantom/default.nix | 1 + hosts/phantom/forgejo.nix | 40 ++++++++++++++++++++++++++++++++++++++ hosts/phantom/mastodon.nix | 1 + 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 hosts/phantom/forgejo.nix diff --git a/flake.lock b/flake.lock index 8f9720a..9f50cd4 100644 --- a/flake.lock +++ b/flake.lock @@ -866,11 +866,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1710695816, - "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", + "lastModified": 1712310679, + "narHash": "sha256-XgC/a/giEeNkhme/AV1ToipoZ/IVm1MV2ntiK4Tm+pw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "614b4613980a522ba49f0d194531beddbb7220d3", + "rev": "72da83d9515b43550436891f538ff41d68eecc7f", "type": "github" }, "original": { diff --git a/hosts/phantom/default.nix b/hosts/phantom/default.nix index 47b8757..782b783 100644 --- a/hosts/phantom/default.nix +++ b/hosts/phantom/default.nix @@ -12,6 +12,7 @@ ./writefreely.nix ./renawiki.nix ./email.nix + ./forgejo.nix ]; # # Enable networking diff --git a/hosts/phantom/forgejo.nix b/hosts/phantom/forgejo.nix new file mode 100644 index 0000000..ca31329 --- /dev/null +++ b/hosts/phantom/forgejo.nix @@ -0,0 +1,40 @@ +{ lib, pkgs, config, ... }: +let + cfg = config.services.forgejo; + srv = cfg.settings.server; +in +{ + services.nginx = { + virtualHosts.${cfg.settings.server.DOMAIN} = { + forceSSL = true; + enableACME = true; + extraConfig = '' + client_max_body_size 512M; + ''; + locations."/".proxyPass = "http://localhost:${toString srv.HTTP_PORT}"; + }; + }; + + services.openssh = { + authorizedKeysFiles = [ + "${config.services.forgejo.stateDir}/.ssh/authorized_keys" + ]; + # Recommended by forgejo: https://forgejo.org/docs/latest/admin/recommendations/#git-over-ssh + settings.AcceptEnv = "GIT_PROTOCOL"; + }; + + services.forgejo = { + enable = true; + database.type = "postgres"; + lfs.enable = true; + settings = { + service.DISABLE_REGISTRATION = true; + server = { + DOMAIN = "git.lelgenio.xyz"; + HTTP_PORT = 3000; + ROOT_URL = "${srv.PROTOCOL}://${srv.DOMAIN}/"; + SSH_PORT = 9022; + }; + }; + }; +} diff --git a/hosts/phantom/mastodon.nix b/hosts/phantom/mastodon.nix index 3e629d7..adfaf0d 100644 --- a/hosts/phantom/mastodon.nix +++ b/hosts/phantom/mastodon.nix @@ -6,5 +6,6 @@ smtp.fromAddress = "lelgenio@disroot.org"; streamingProcesses = 2; extraConfig.SINGLE_USER_MODE = "true"; + mediaAutoRemove.olderThanDays = 10; }; }