Files
infra/modules/nixos/services/systemd/versioncontrol.nix

34 lines
1023 B
Nix
Raw Normal View History

{ config, pkgs, self, ... }:
let
2025-12-27 17:14:22 -05:00
versioncontrol_compose_dir = builtins.path {
name = "versioncontrol_compose_dir";
2025-12-27 17:14:22 -05:00
path = self + "/assets/compose/versioncontrol";
};
in
{
networking.firewall.allowedTCPPorts = [ 2222 ];
systemd.services.versioncontrol_stack = {
description = "Gitea via Docker Compose";
after = [ "network-online.target" "docker.service" ];
wants = [ "network-online.target" "docker.service" ];
serviceConfig = {
WorkingDirectory = "${versioncontrol_compose_dir}";
# Stop left over container by the same name
ExecStartPre = "${pkgs.bash}/bin/bash -c '${pkgs.docker-compose}/bin/docker-compose down || true'";
2025-08-08 18:18:47 -04:00
# Start the services using Docker Compose
ExecStart = "${pkgs.docker-compose}/bin/docker-compose up -d";
2025-08-08 18:18:47 -04:00
# Stop and remove containers on shutdown
ExecStop = "${pkgs.docker-compose}/bin/docker-compose down";
RemainAfterExit = true;
TimeoutStartSec = 0;
};
wantedBy = [ "multi-user.target" ];
};
}