nix-da/hosts/raptus/forgejo/default.nix

64 lines
1.7 KiB
Nix

{ lib, pkgs, ... }:
{
# Containers
virtualisation.oci-containers.containers."forgejo" = {
image = "codeberg.org/forgejo/forgejo:8";
environment = {
"USER_GID" = "1000";
"USER_UID" = "1000";
FORGEJO__migrations__ALLOWED_DOMAINS = "github.com,*.github.com";
FORGEJO__server__SSH_PORT = "222";
};
volumes = [
"test_forgejo:/data:rw"
];
ports = [
"3000:3000/tcp"
"222:22/tcp"
];
log-driver = "journald";
extraOptions = [
"--network-alias=server"
"--network=test_forgejo"
];
};
systemd.services."podman-forgejo" = {
serviceConfig = {
Restart = lib.mkOverride 500 "always";
};
after = [ "podman-network-test_forgejo.service" ];
requires = [ "podman-network-test_forgejo.service" ];
partOf = [ "podman-compose-test-root.target" ];
wantedBy = [ "podman-compose-test-root.target" ];
};
# Networks
systemd.services."podman-network-test_forgejo" = {
path = [ pkgs.podman ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStop = "podman network rm -f test_forgejo";
};
script = ''
podman network inspect test_forgejo || podman network create test_forgejo
'';
partOf = [ "podman-compose-test-root.target" ];
wantedBy = [ "podman-compose-test-root.target" ];
};
# Volumes
systemd.services."podman-volume-test_forgejo" = {
path = [ pkgs.podman ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
script = ''
podman volume inspect test_forgejo || podman volume create test_forgejo
'';
partOf = [ "podman-compose-test-root.target" ];
wantedBy = [ "podman-compose-test-root.target" ];
};
}