adding gitea

This commit is contained in:
2025-01-12 14:31:39 -06:00
parent 8234b1bce0
commit 07165a0f3c
3 changed files with 106 additions and 4 deletions

View File

@@ -0,0 +1,93 @@
{ config, lib, pkgs, ... }: {
options.sysconfig.opts.virtualization.gitea.enable = lib.options.mkOption {
type = lib.types.bool;
default = false;
};
config = lib.mkIf config.sysconfig.opts.virtualization.gitea.enable {
sops.secrets = {
"gitea/db_pass" = {};
};
services.openssh.ports = [
2222
];
networking.firewall.allowedTCPPorts = [
22
2222
];
containers.gitea = {
autoStart = true;
privateNetwork = true;
hostAddress = "192.168.100.10";
localAddress = "192.168.100.20";
forwardPorts = [
{
containerPort = 22;
hostPort = 22;
}
];
bindMounts = {
"/etc/gitea/data" = {
hostPath = "/ssd1/Gitea/data";
isReadOnly = false;
};
};
extraFlags = [
"--load-credential=dbpass:${config.sops.secrets."gitlab/db_pass".path}"
];
config = {
systemd.services.secrets_setup = {
wantedBy = [ "gitea.service" ];
serviceConfig = {
LoadCredential = [
"dbpass"
];
};
script = ''
cat ''${CREDENTIALS_DIRECTORY}/dbpass > /etc/gitea/dbpass
chown gitea:gitea /etc/gitea/*
'';
};
services.gitea = {
enable = true;
stateDir = "/etc/gitea/data";
dump.enable = true;
settings = {
server = {
DOMAIN = "gitea.blunkall.us";
HTTP_PORT = 80;
};
service.DISABLE_REGISTRATION = false;
session.COOKIE_SECURE = true;
};
database = {
passwordFile = "/etc/gitea/dbpass";
type = "postgres";
};
};
services.openssh.enable = true;
networking.firewall.allowedTCPPorts = [ 22 80 ];
system.stateVersion = "24.11";
};
};
};
}