refactor: moved subdomain options into proxy file

This commit is contained in:
Leyla Becker 2025-09-16 10:44:00 -05:00
parent dfdd6bcc82
commit 9b02e30080
16 changed files with 84 additions and 73 deletions

View file

@ -12,14 +12,6 @@ in {
./impermanence.nix ./impermanence.nix
]; ];
options.services.actual = {
subdomain = lib.mkOption {
type = lib.types.str;
default = "actual";
description = "subdomain of base domain that actual will be hosted at";
};
};
config = lib.mkIf config.services.actual.enable { config = lib.mkIf config.services.actual.enable {
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d ${dataDirectory} 2770 actual actual" "d ${dataDirectory} 2770 actual actual"

View file

@ -3,6 +3,14 @@
config, config,
... ...
}: { }: {
options.services.actual = {
subdomain = lib.mkOption {
type = lib.types.str;
default = "actual";
description = "subdomain of base domain that actual will be hosted at";
};
};
config = lib.mkIf (config.services.actual.enable && config.host.reverse_proxy.enable) { config = lib.mkIf (config.services.actual.enable && config.host.reverse_proxy.enable) {
host = { host = {
reverse_proxy.subdomains.${config.services.actual.subdomain} = { reverse_proxy.subdomains.${config.services.actual.subdomain} = {

View file

@ -15,14 +15,6 @@ in {
./impermanence.nix ./impermanence.nix
]; ];
options.services.forgejo = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that forgejo will be hosted at";
default = "forgejo";
};
};
config = lib.mkIf config.services.forgejo.enable { config = lib.mkIf config.services.forgejo.enable {
assertions = [ assertions = [
{ {

View file

@ -6,6 +6,14 @@
const = import ./const.nix; const = import ./const.nix;
httpPort = const.httpPort; httpPort = const.httpPort;
in { in {
options.services.forgejo = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that forgejo will be hosted at";
default = "forgejo";
};
};
config = lib.mkIf (config.services.forgejo.enable && config.host.reverse_proxy.enable) { config = lib.mkIf (config.services.forgejo.enable && config.host.reverse_proxy.enable) {
host.reverse_proxy.subdomains.${config.services.forgejo.subdomain} = { host.reverse_proxy.subdomains.${config.services.forgejo.subdomain} = {
target = "http://localhost:${toString httpPort}"; target = "http://localhost:${toString httpPort}";

View file

@ -12,12 +12,6 @@
]; ];
options.services.home-assistant = { options.services.home-assistant = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that home-assistant will be hosted at";
default = "home-assistant";
};
database = lib.mkOption { database = lib.mkOption {
type = lib.types.enum [ type = lib.types.enum [
"builtin" "builtin"

View file

@ -2,8 +2,16 @@
lib, lib,
config, config,
... ...
}: }: {
lib.mkIf (config.host.reverse_proxy.enable && config.services.home-assistant.enable) { options.services.home-assistant = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that home-assistant will be hosted at";
default = "home-assistant";
};
};
config = lib.mkIf (config.host.reverse_proxy.enable && config.services.home-assistant.enable) {
host = { host = {
reverse_proxy.subdomains.${config.services.home-assistant.subdomain} = { reverse_proxy.subdomains.${config.services.home-assistant.subdomain} = {
target = "http://localhost:${toString config.services.home-assistant.config.http.server_port}"; target = "http://localhost:${toString config.services.home-assistant.config.http.server_port}";
@ -21,4 +29,5 @@ lib.mkIf (config.host.reverse_proxy.enable && config.services.home-assistant.ena
''; '';
}; };
}; };
};
} }

View file

@ -1,4 +1,4 @@
{lib, ...}: { {...}: {
imports = [ imports = [
./proxy.nix ./proxy.nix
./database.nix ./database.nix
@ -6,14 +6,6 @@
./impermanence.nix ./impermanence.nix
]; ];
options.services.immich = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that immich will be hosted at";
default = "immich";
};
};
# NOTE: This shouldn't be needed now that we are out of testing # NOTE: This shouldn't be needed now that we are out of testing
# config = lib.mkIf config.services.immich.enable { # config = lib.mkIf config.services.immich.enable {
# networking.firewall.interfaces.${config.services.tailscale.interfaceName} = { # networking.firewall.interfaces.${config.services.tailscale.interfaceName} = {

View file

@ -3,6 +3,14 @@
config, config,
... ...
}: { }: {
options.services.immich = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that immich will be hosted at";
default = "immich";
};
};
config = lib.mkIf (config.services.immich.enable && config.host.reverse_proxy.enable) { config = lib.mkIf (config.services.immich.enable && config.host.reverse_proxy.enable) {
host = { host = {
reverse_proxy.subdomains.${config.services.immich.subdomain} = { reverse_proxy.subdomains.${config.services.immich.subdomain} = {

View file

@ -14,16 +14,6 @@ in {
]; ];
options.services.jellyfin = { options.services.jellyfin = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that jellyfin will be hosted at";
default = "jellyfin";
};
extraSubdomains = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "ex subdomain of base domain that jellyfin will be hosted at";
default = [];
};
media_directory = lib.mkOption { media_directory = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "directory jellyfin media will be hosted at"; description = "directory jellyfin media will be hosted at";

View file

@ -5,6 +5,19 @@
}: let }: let
jellyfinPort = 8096; jellyfinPort = 8096;
in { in {
options.services.jellyfin = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that jellyfin will be hosted at";
default = "jellyfin";
};
extraSubdomains = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "ex subdomain of base domain that jellyfin will be hosted at";
default = [];
};
};
config = lib.mkIf (config.services.jellyfin.enable && config.host.reverse_proxy.enable) { config = lib.mkIf (config.services.jellyfin.enable && config.host.reverse_proxy.enable) {
host.reverse_proxy.subdomains.jellyfin = { host.reverse_proxy.subdomains.jellyfin = {
target = "http://localhost:${toString jellyfinPort}"; target = "http://localhost:${toString jellyfinPort}";

View file

@ -57,12 +57,6 @@ in {
description = "The panoramax package to use"; description = "The panoramax package to use";
}; };
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that panoramax will be hosted at";
default = "panoramax";
};
database = { database = {
createDB = mkOption { createDB = mkOption {
type = types.bool; type = types.bool;

View file

@ -3,6 +3,14 @@
config, config,
... ...
}: { }: {
options.services.panoramax = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that panoramax will be hosted at";
default = "panoramax";
};
};
config = lib.mkIf (config.services.panoramax.enable && config.host.reverse_proxy.enable) { config = lib.mkIf (config.services.panoramax.enable && config.host.reverse_proxy.enable) {
host = { host = {
reverse_proxy.subdomains.${config.services.panoramax.subdomain} = { reverse_proxy.subdomains.${config.services.panoramax.subdomain} = {

View file

@ -11,11 +11,6 @@
]; ];
options.services.paperless = { options.services.paperless = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that paperless will be hosted at";
default = "paperless";
};
database = { database = {
user = lib.mkOption { user = lib.mkOption {
type = lib.types.str; type = lib.types.str;

View file

@ -3,6 +3,14 @@
lib, lib,
... ...
}: { }: {
options.services.paperless = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that paperless will be hosted at";
default = "paperless";
};
};
config = lib.mkIf (config.services.paperless.enable && config.host.reverse_proxy.enable) { config = lib.mkIf (config.services.paperless.enable && config.host.reverse_proxy.enable) {
host = { host = {
reverse_proxy.subdomains.${config.services.paperless.subdomain} = { reverse_proxy.subdomains.${config.services.paperless.subdomain} = {

View file

@ -8,14 +8,6 @@
./proxy.nix ./proxy.nix
]; ];
options.services.searx = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that searx will be hosted at";
default = "searx";
};
};
config = lib.mkIf config.services.searx.enable { config = lib.mkIf config.services.searx.enable {
sops.secrets = { sops.secrets = {
"services/searx" = { "services/searx" = {

View file

@ -3,6 +3,14 @@
lib, lib,
... ...
}: { }: {
options.services.searx = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that searx will be hosted at";
default = "searx";
};
};
config = lib.mkIf (config.services.searx.enable && config.host.reverse_proxy.enable) { config = lib.mkIf (config.services.searx.enable && config.host.reverse_proxy.enable) {
host = { host = {
reverse_proxy.subdomains.searx = { reverse_proxy.subdomains.searx = {