drafted up ssh config for forgejo

This commit is contained in:
Leyla Becker 2025-02-20 19:48:52 -06:00
parent ca20590d14
commit c6bdff8603
2 changed files with 25 additions and 1 deletions

View file

@ -53,6 +53,14 @@
}; };
}; };
# networking.extraHosts = ''
# # 192.168.1.204 jan-leila.com
# 192.168.1.204 media.jan-leila.com
# # 192.168.1.204 drive.jan-leila.com
# 192.168.1.204 git.jan-leila.com
# # 192.168.1.204 search.jan-leila.com
# '';
# Enable touchpad support (enabled default in most desktopManager). # Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true; # services.xserver.libinput.enable = true;

View file

@ -5,6 +5,8 @@
}: let }: let
forgejoPort = 8081; forgejoPort = 8081;
stateDir = "/var/lib/forgejo"; stateDir = "/var/lib/forgejo";
db_user = "forgejo";
sshPort = 2222;
in { in {
options.host.forgejo = { options.host.forgejo = {
enable = lib.mkEnableOption "should forgejo be enabled on this computer"; enable = lib.mkEnableOption "should forgejo be enabled on this computer";
@ -24,7 +26,7 @@ in {
postgres = { postgres = {
enable = true; enable = true;
extraUsers = { extraUsers = {
forgejo = { ${db_user} = {
isClient = true; isClient = true;
}; };
}; };
@ -42,12 +44,26 @@ in {
server = { server = {
DOMAIN = "${config.host.forgejo.subdomain}.${config.host.reverse_proxy.hostname}"; DOMAIN = "${config.host.forgejo.subdomain}.${config.host.reverse_proxy.hostname}";
HTTP_PORT = forgejoPort; HTTP_PORT = forgejoPort;
START_SSH_SERVER = true;
SSH_LISTEN_PORT = sshPort;
SSH_PORT = 22;
# TODO: we need to create this user, and then store their authorized keys somewhere and have both ssh server allow login in as that user based on those authorized keys
BUILTIN_SSH_SERVER_USER = "git";
}; };
service = { service = {
DISABLE_REGISTRATION = true; DISABLE_REGISTRATION = true;
}; };
database = {
DB_TYPE = "postgres";
NAME = db_user;
USER = db_user;
};
}; };
}; };
networking.firewall.allowedTCPPorts = [
config.services.forgejo.settings.server.SSH_LISTEN_PORT
];
} }
(lib.mkIf config.host.impermanence.enable { (lib.mkIf config.host.impermanence.enable {
assertions = [ assertions = [