Move gitea into options

This commit is contained in:
Andreas Zweili 2023-06-05 15:07:16 +02:00
parent bc3a6bf629
commit b45cf61f92
3 changed files with 54 additions and 37 deletions

View File

@ -20,6 +20,7 @@
./services/data-share
./services/docker
./services/docker-mailserver
./gitea
./services/logs-share
./services/log-to-ram
./services/pipewire

View File

@ -1,41 +1,54 @@
{ domain }: { config, inputs, ... }:
{ config, inputs, lib, ... }:
let
cfg = config.services.az-gitea;
in
{
age.secrets.giteaEnv.file = "${inputs.self}/scrts/gitea_env.age";
options = {
services.az-gitea.enable = lib.mkEnableOption "Enable Gitea in Docker.";
services.az-gitea.domain = lib.mkOption {
type = lib.types.str;
description = "The domain Gitea is being run from.";
};
};
services.az-docker.enable = true;
config = lib.mkIf cfg.enable {
age.secrets.giteaEnv.file = "${inputs.self}/scrts/gitea_env.age";
virtualisation.oci-containers = {
backend = "docker";
containers."gitea" = {
# https://blog.gitea.io/
# https://hub.docker.com/r/gitea/gitea/tags
image = "gitea/gitea:1.19.3";
autoStart = true;
environment = {
PUID = "1000";
PGID = "100";
DB_TYPE = "mysql";
DB_HOST = "host.docker.internal:3306";
DB_NAME = "giteadb";
DB_USER = "gitea";
ROOT_URL = "${domain}";
INSTALL_LOCK = "true";
DISABLE_REGISTRATION = "true";
services.az-docker.enable = true;
virtualisation.oci-containers = {
backend = "docker";
containers."gitea" = {
# https://blog.gitea.io/
# https://hub.docker.com/r/gitea/gitea/tags
image = "gitea/gitea:1.19.3";
autoStart = true;
environment = {
PUID = "1000";
PGID = "100";
DB_TYPE = "mysql";
DB_HOST = "host.docker.internal:3306";
DB_NAME = "giteadb";
DB_USER = "gitea";
ROOT_URL = "${cfg.domain}";
INSTALL_LOCK = "true";
DISABLE_REGISTRATION = "true";
};
environmentFiles = [ config.age.secrets.giteaEnv.path ];
ports = [
"2222:22"
"8080:3000"
];
volumes = [
"/etc/timezone:/etc/timezone:ro"
"/etc/localtime:/etc/localtime:ro"
];
extraOptions = [
''--mount=type=volume,source=gitea_data,target=/data,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/gitea/data,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
"--add-host=host.docker.internal:host-gateway"
"--log-opt=tag='gitea'"
];
};
environmentFiles = [ config.age.secrets.giteaEnv.path ];
ports = [
"2222:22"
"8080:3000"
];
volumes = [
"/etc/timezone:/etc/timezone:ro"
"/etc/localtime:/etc/localtime:ro"
];
extraOptions = [
''--mount=type=volume,source=gitea_data,target=/data,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/gitea/data,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
"--add-host=host.docker.internal:host-gateway"
"--log-opt=tag='gitea'"
];
};
};
}

View File

@ -15,9 +15,12 @@ in
(import "${inputs.self}/modules/nginx-proxy" {
inherit domain;
})
(import "${inputs.self}/modules/gitea" {
inherit domain;
})
"${inputs.self}/modules/mariadb"
];
services = {
az-gitea = {
enable = true;
domain = domain;
};
};
}