init forgejo

This commit is contained in:
twoneis 2025-02-08 01:19:49 +01:00
parent 912e0a1617
commit 96baf34521
4 changed files with 39 additions and 0 deletions

View file

@ -5,6 +5,7 @@
website.enable = true; website.enable = true;
fedi.enable = false; # Currently broken fedi.enable = false; # Currently broken
matrix.enable = true; matrix.enable = true;
git.enable = true;
stateVersion = "25.05"; stateVersion = "25.05";
hmStateVersion = "25.05"; hmStateVersion = "25.05";

View file

@ -7,6 +7,7 @@ in {
./fedi ./fedi
./fonts ./fonts
./games ./games
./git
./home ./home
./layout ./layout
./matrix ./matrix

36
modules/git/default.nix Normal file
View file

@ -0,0 +1,36 @@
{ lib, config, ... }: let
inherit (lib) mkIf;
inherit (config) conf;
cfg = config.services.forgejo.settings.server;
in mkIf conf.git.enable {
services = {
nginx = {
virtualHosts.${cfg.DOMAIN} = {
forceSSL = true;
useACMEHost = "twoneis.site";
extraConfig = ''
client_max_body_size 512M;
'';
locations."/".proxyPass = "http://localhost:${toString cfg.HTTP_PORT}";
};
};
forgejo = {
enable = true;
database.type = "postgres";
lfs.enable = true;
settings = {
server = {
DOMAIN = "git.twoneis.site";
ROOT_URL = "https://${cfg.DOMAIN}";
HTTP_PORT = 3000;
};
service.DISABLE_REGISTRATION = true;
actions = {
ENABLED = true;
DEFAULT_ACTIONS_URL = "github";
};
};
};
};
}

View file

@ -21,6 +21,7 @@ in {
website.enable = mkEnableOption "Serve website through nginx. Nginx must be enabled to work correctly."; website.enable = mkEnableOption "Serve website through nginx. Nginx must be enabled to work correctly.";
fedi.enable = mkEnableOption "Host a fedi server on this machine."; fedi.enable = mkEnableOption "Host a fedi server on this machine.";
matrix.enable = mkEnableOption "Host a matrix server on this machine"; matrix.enable = mkEnableOption "Host a matrix server on this machine";
git.enable = mkEnableOption "Host a git server on this machine";
# Mixed and more complex options # Mixed and more complex options
username = mkOption { username = mkOption {