feat(nixos): deploy Gitea guest on Pikachu

This commit is contained in:
alexion committed 2026-10-22 16:47:35 -04:00
1 parent c370d635e5
commit 7737f72328
6 files changed
+121 -8

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
{
config,
lib,
registry,
...
}:
let
cfg = config.guests.gitea;
in
{
options.guests.gitea.dataPath = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "/srv/gitea";
description = "Host path mounted as Gitea's state directory.";
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = cfg.dataPath != null;
message = "guests.gitea.dataPath must point at the host directory that stores Gitea state.";
}
];
guests.gitea = {
interior.modules.services.gitea = {
enable = true;
reverseProxyAddress = registry.address.${config.networking.hostName}."reverse-proxy";
};
mounts."/var/lib/gitea" = {
directory = cfg.dataPath;
owner = config.registry."stable-uid".${config.networking.hostName}.gitea;
group = "storage";
mode = "2770";
};
};
};
}
+6 -5
View File
@@ -1,10 +1,11 @@
{
config,
lib,
registry,
...
}:
let
giteaSshBackend = "10.23.20.45:2022";
giteaAddress = registry.address.${config.networking.hostName}.gitea;
in
{
config = lib.mkIf config.guests.reverse-proxy.enable {
@@ -16,7 +17,7 @@ in
"git.alexion.dev" = {
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://10.23.20.32";
locations."/".proxyPass = "http://${giteaAddress}:3000";
};
"photos.alexion.dev" = {
forceSSL = true;
@@ -45,12 +46,12 @@ in
};
};
networking.firewall.allowedTCPPorts = [ 2022 ];
networking.firewall.allowedTCPPorts = [ 22 ];
services.nginx.streamConfig = ''
server {
listen 2022;
proxy_pass ${giteaSshBackend};
listen 22;
proxy_pass ${giteaAddress}:2222;
}
'';
};