treewide: refactor code

This commit is contained in:
2026-05-03 18:08:13 -04:00
parent a5b2e46586
commit 5a03f66a34
4 changed files with 43 additions and 37 deletions
+1
View File
@@ -11,5 +11,6 @@
dns.enable = true;
networking.fqdn = "tuxcord.net";
time.timeZone = "Canada/Eastern";
}
+1
View File
@@ -1,5 +1,6 @@
{
acme.enable = false;
dns.enable = true;
networking.fqdn = "tuxcord.test";
}
+10 -14
View File
@@ -1,4 +1,9 @@
{ config, lib, ... }:
{
config,
lib,
self,
...
}:
let
cfg = config.dns;
@@ -20,24 +25,17 @@ let
subdomain = name: "subdomain ${name}";
zoneDomain =
if lib.strings.hasSuffix ".key.age" filename then
lib.strings.removeSuffix ".key.age" filename
if strings.hasSuffix ".key.age" filename then
strings.removeSuffix ".key.age" filename
else
throw "${filename} is not a `.key.age` file";
in
{
inherit (config.age.secrets."dns/${filename}") path;
name = zoneDomain;
path = config.age.secrets."dns/${filename}".path;
type = if zoneDomain == fqdn then zonesub else subdomain;
}
) agenixKeys;
cfg = config.dns;
inherit (lib)
mkEnableOption
mkOption
mkIf
;
in
{
options.dns = {
@@ -70,8 +68,7 @@ in
extraConfig = builtins.concatStringsSep "\n" (map (key: "include \"${key.path}\";") keys);
zones = {
"${fqdn}" = {
zones."${fqdn}" = {
# grant "tuxcord.net" zonesub ANY;
extraConfig = ''
update-policy {
@@ -84,7 +81,6 @@ in
master = true;
};
};
};
environment.persistence."/persist".directories = [
{
+20 -12
View File
@@ -1,4 +1,4 @@
{ config, lib, ... }:
{ config, ... }:
let
inherit (config.networking) fqdn;
@@ -8,25 +8,33 @@ in
services.gitea = {
enable = true;
appName = "Tuxcord's Gitea";
appName = "TuxCord Gitea";
database.type = "mysql";
lfs.enable = true;
settings.server.DOMAIN = fqdn;
settings.server.ROOT_URL = "${if isHTTPS then "https" else "http"}://${fqdn}/";
settings.server.HTTP_PORT = 3000;
settings = {
server = {
DOMAIN = fqdn;
ROOT_URL = "${if acmeEnabled then "https" else "http"}://${fqdn}/";
HTTP_PORT = 3000;
};
settings.service.DISABLE_REGISTRATION = true;
settings.service.REQUIRE_SIGNIN_VIEW = false;
service = {
DISABLE_REGISTRATION = true;
REQUIRE_SIGNIN_VIEW = false;
};
settings.repository.ENABLE_PUSH_CREATE_USER = true;
settings.repository.ENABLE_PUSH_CREATE_ORG = true;
settings.repository.DEFAULT_BRANCH = "main";
repository = {
ENABLE_PUSH_CREATE_USER = true;
ENABLE_PUSH_CREATE_ORG = true;
DEFAULT_BRANCH = "main";
};
# settings.ui.DEFAULT_THEME = "...";
# ui.DEFAULT_THEME = "...";
# TODO: once we have email setup this would be nice
settings.mailer.ENABLED = true;
mailer.ENABLED = true;
};
};
}