treewide: refactor code
This commit is contained in:
@@ -11,5 +11,6 @@
|
||||
|
||||
dns.enable = true;
|
||||
networking.fqdn = "tuxcord.net";
|
||||
|
||||
time.timeZone = "Canada/Eastern";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
acme.enable = false;
|
||||
dns.enable = true;
|
||||
|
||||
networking.fqdn = "tuxcord.test";
|
||||
}
|
||||
|
||||
+13
-17
@@ -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,10 +81,6 @@ in
|
||||
master = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ config.services.bind.listenOnPort ];
|
||||
networking.firewall.allowedUDPPorts = [ config.services.bind.listenOnPort ];
|
||||
|
||||
environment.persistence."/persist" = {
|
||||
directories = [
|
||||
@@ -98,5 +91,8 @@ in
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ config.services.bind.listenOnPort ];
|
||||
networking.firewall.allowedUDPPorts = [ config.services.bind.listenOnPort ];
|
||||
};
|
||||
}
|
||||
|
||||
+20
-12
@@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user