forgejo works now but vaultwarden is fucky

This commit is contained in:
KoenDR06 2025-12-29 01:45:04 +01:00
parent f1b3559434
commit 02eb92a443
5 changed files with 140 additions and 15 deletions

View file

@ -6,25 +6,35 @@
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf;
inherit (lib) types mkOption mkEnableOption mkIf;
cfg = config.horseman.containers.forgejo;
username = config.horseman.username;
HTTP_PORT = 3000;
SSH_PORT = 34916;
INSTANCE_URL = "http://local.git.server:3000";
DATA_DIR = "/home/${username}/backups/volumes/forgejo";
BACKUP_FILE = "/home/${username}/backups/forgejo.tar";
in {
options = {
horseman.containers.forgejo = {
enable = mkEnableOption "forgejo containers";
port = mkOption {
default = 3000;
type = types.int;
};
sshPort = mkOption {
default = 34916;
type = types.int;
};
url = mkOption {
default = "https://git.koendev.nl";
type = types.str;
};
};
};
config = mkIf cfg.enable {
networking.extraHosts = "192.168.100.3 local.git.server";
systemd.timers."backup-forgejo" = {
wantedBy = ["timers.target"];
timerConfig = {
@ -36,7 +46,7 @@ in {
environment.systemPackages = [pkgs.gnutar];
systemd.services."backup-forgejo" = {
script = ''
${pkgs.gnutar} -cf ${BACKUP_FILE} ${DATA_DIR}
${pkgs.gnutar}/bin/tar -cf ${BACKUP_FILE} ${DATA_DIR}
'';
serviceConfig = {
User = "root";
@ -123,9 +133,9 @@ in {
settings = {
server = {
HTTP_PORT = HTTP_PORT;
SSH_PORT = SSH_PORT;
ROOT_URL = INSTANCE_URL;
HTTP_PORT = cfg.port;
SSH_PORT = cfg.sshPort;
ROOT_URL = cfg.url;
};
session = {
COOKIE_SECURE = false; # TODO Set to true
@ -148,7 +158,7 @@ in {
networking = {
firewall = {
enable = true;
allowedTCPPorts = [HTTP_PORT SSH_PORT];
allowedTCPPorts = [cfg.port cfg.sshPort];
};
# Use systemd-resolved inside the container
# Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686