Avoid "networking.domain"

This commit is contained in:
SebastianStork 2025-05-28 21:11:51 +02:00
parent 383235ae24
commit d5f7e88b59
10 changed files with 32 additions and 29 deletions

View file

@ -9,7 +9,7 @@ in
{
options.custom.services.actualbudget = {
enable = lib.mkEnableOption "";
subdomain = lib.mkOption {
domain = lib.mkOption {
type = lib.types.nonEmptyStr;
default = "";
};
@ -28,7 +28,6 @@ in
services.actual = {
enable = true;
settings = {
hostname = "localhost";
inherit (cfg) port;

View file

@ -11,7 +11,7 @@ in
{
options.custom.services.forgejo = {
enable = lib.mkEnableOption "";
subdomain = lib.mkOption {
domain = lib.mkOption {
type = lib.types.nonEmptyStr;
default = "";
};
@ -30,7 +30,7 @@ in
settings = {
server = {
DOMAIN = "${cfg.subdomain}.${config.networking.domain}";
DOMAIN = cfg.domain;
ROOT_URL = "https://${config.services.forgejo.settings.server.DOMAIN}/";
HTTP_PORT = cfg.port;
};

View file

@ -14,7 +14,7 @@ in
{
options.custom.services.hedgedoc = {
enable = lib.mkEnableOption "";
subdomain = lib.mkOption {
domain = lib.mkOption {
type = lib.types.nonEmptyStr;
default = "";
};
@ -42,7 +42,7 @@ in
environmentFile = config.sops.templates."hedgedoc/environment".path;
settings = {
domain = "${cfg.subdomain}.${config.networking.domain}";
domain = cfg.domain;
inherit (cfg) port;
protocolUseSSL = true;
allowAnonymous = false;

View file

@ -13,7 +13,7 @@ in
{
options.custom.services.nextcloud = {
enable = lib.mkEnableOption "";
subdomain = lib.mkOption {
domain = lib.mkOption {
type = lib.types.nonEmptyStr;
default = "";
};
@ -30,7 +30,7 @@ in
services.nextcloud = {
enable = true;
package = pkgs.nextcloud31;
hostName = "${cfg.subdomain}.${config.networking.domain}";
hostName = cfg.domain;
database.createLocally = true;
config = {

View file

@ -6,6 +6,7 @@
}:
let
cfg = config.custom.services.syncthing;
tsCfg = config.custom.services.tailscale;
in
{
options.custom.services.syncthing = {
@ -18,6 +19,13 @@ in
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = tsCfg.enable;
message = "syncthing requires tailscale";
}
];
services.syncthing = {
enable = true;
@ -36,7 +44,7 @@ in
|> lib.mapAttrs (
name: value: {
id = value.config.custom.services.syncthing.deviceId;
addresses = [ "tcp://${name}.${value.config.networking.domain}:22000" ];
addresses = [ "tcp://${name}.${tsCfg.domain}:22000" ];
}
);

View file

@ -53,7 +53,7 @@ in
virtualHosts = lib.mapAttrs' (
_: value:
lib.nameValuePair "https://${value.subdomain}.${config.networking.domain}" {
lib.nameValuePair "https://${value.subdomain}.${config.custom.services.tailscale.domain}" {
extraConfig = ''
bind tailscale/${value.subdomain}
tailscale_auth

View file

@ -10,9 +10,9 @@ in
{
options.custom.services.tailscale = {
enable = lib.mkEnableOption "";
subdomain = lib.mkOption {
domain = lib.mkOption {
type = lib.types.nonEmptyStr;
default = config.networking.hostName;
default = "stork-atlas.ts.net";
};
ssh.enable = lib.mkEnableOption "";
exitNode.enable = lib.mkEnableOption "";
@ -36,7 +36,6 @@ in
if (cfg.exitNode.enable || (cfg.serve.target != null)) then "server" else "client";
extraUpFlags = [ "--reset=true" ];
extraSetFlags = [
"--hostname=${cfg.subdomain}"
"--ssh=${lib.boolToString cfg.ssh.enable}"
"--advertise-exit-node=${lib.boolToString cfg.exitNode.enable}"
];
@ -57,7 +56,7 @@ in
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStartPre = "${lib.getExe pkgs.tailscale} cert --min-validity 120h ${cfg.subdomain}.${config.networking.domain}";
ExecStartPre = "${lib.getExe pkgs.tailscale} cert --min-validity 120h ${config.networking.hostName}.${cfg.domain}";
ExecStart = "${lib.getExe pkgs.tailscale} ${mode} --bg ${cfg.serve.target}";
ExecStop = "${lib.getExe pkgs.tailscale} ${mode} reset";
Restart = "on-failure";