Extract gitea domain to variable

This commit is contained in:
2024-07-21 14:06:07 +01:00
parent 41b40d7b6a
commit 314129496d

View File

@ -1,18 +1,17 @@
{ config, lib, pkgs, inputs, ... }: { config, lib, pkgs, inputs, ... }:
with lib;
let let
cfg = config.modules.services.gitea; cfg = config.modules.services.gitea;
in { in {
options.modules.services.gitea = { options.modules.services.gitea = {
enable = mkOption { enable = lib.mkEnableOption "gitea";
default = false; domain = lib.mkOption {
example = true; type = lib.types.string;
default = "git.vimium.com";
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
users = { users = {
users.git = { users.git = {
isSystemUser = true; isSystemUser = true;
@ -31,7 +30,7 @@ in {
}; };
}; };
virtualHosts = { virtualHosts = {
"git.vimium.com" = { "${cfg.domain}" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
locations."/".proxyPass = "http://gitea"; locations."/".proxyPass = "http://gitea";
@ -69,9 +68,9 @@ in {
OFFLINE_MODE = true; OFFLINE_MODE = true;
PROTOCOL = "http+unix"; PROTOCOL = "http+unix";
SSH_USER = "git"; SSH_USER = "git";
SSH_DOMAIN = "git.vimium.com"; SSH_DOMAIN = "${cfg.domain}";
SSH_PORT = lib.head config.services.openssh.ports; SSH_PORT = lib.head config.services.openssh.ports;
ROOT_URL = "https://git.vimium.com/"; ROOT_URL = "https://${cfg.domain}/";
}; };
service.DISABLE_REGISTRATION = true; service.DISABLE_REGISTRATION = true;
session.COOKIE_SECURE = true; session.COOKIE_SECURE = true;