file cleanup, conditional motd

This commit is contained in:
2026-06-14 08:35:44 -05:00
parent fcb8961c69
commit 11d3fcd8ec
27 changed files with 407 additions and 409 deletions
+29 -23
View File
@@ -1,12 +1,14 @@
{ pkgs, nixpkgs-unstable, config, lib, ... }:
let
{
pkgs,
config,
lib,
...
}: let
service = "gitea";
cfg = config.homelab.${service};
sec = config.sops.secrets;
homelab = config.homelab;
in
{
in {
options.homelab.${service} = {
enable = lib.mkEnableOption "enables ${service}";
@@ -43,21 +45,23 @@ in
};
motd = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = service;
default =
if cfg.enable
then service
else null;
};
};
config = lib.mkIf cfg.enable {
# declare ${service} group
users.groups.${service} = { gid = lib.mkForce cfg.ids; };
users.groups.${service} = {gid = lib.mkForce cfg.ids;};
# declare ${service} user
users.users.${service} = {
description = lib.mkForce "${service} server user";
uid = lib.mkForce cfg.ids;
isSystemUser = true;
shell = pkgs.bash;
shell = pkgs.bash;
home = cfg.data_dir;
createHome = true;
group = service;
@@ -74,17 +78,17 @@ in
user = "gitea";
group = "gitea";
stateDir = cfg.data_dir;
appName = "gitea";
appName = "gitea";
settings = {
server = {
# http config
ROOT_URL = "https://git.blakedheld.xyz";
DOMAIN = "git.blakedheld.xyz";
ROOT_URL = "https://git.${homelab.public_domain}";
DOMAIN = "git.${homelab.public_domain}";
HTTP_PORT = cfg.port;
# local network config
#LOCAL_ROOT_URL = "https://git.snowbelle.lan";
ALLOW_LOCALNETWORKS = true;
ALLOWED_DOMAINS = "10.10.0.10";
ALLOWED_DOMAINS = homelab.host_ip;
SKIP_TLS_VERIFY = true;
# configure for system ssh (trying to use the systms on nix sucks)
SSH_PORT = cfg.ssh_port;
@@ -100,7 +104,7 @@ in
};
};
database = {
passwordFile = "${toString config.sops.secrets."gitea_database_password".path}";
passwordFile = "${toString sec."gitea_database_password".path}";
};
};
@@ -110,7 +114,7 @@ in
};
# open firewall
networking.firewall.allowedTCPPorts = [ cfg.port cfg.ssh_port ];
networking.firewall.allowedTCPPorts = [cfg.port cfg.ssh_port];
# add to caddy for reverse proxy
services.caddy.virtualHosts."git.${homelab.public_domain}" = {
@@ -127,14 +131,16 @@ in
'';
};
# add to glance
homelab.glance.links.services = [{
title = service;
url = "https://git.${homelab.public_domain}";
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
icon = "di:${service}"; }];
homelab.glance.links.services = [
{
title = service;
url = "https://git.${homelab.public_domain}";
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
icon = "di:${service}";
}
];
# manage secrets with sops
sops.secrets = {
@@ -146,7 +152,7 @@ in
# add to backups
homelab.backups.baks = {
${service} = { paths = [ cfg.data_dir ]; };
${service} = {paths = [cfg.data_dir];};
};
};
}