This commit is contained in:
Giulio De Pasquale 2025-04-26 19:31:05 +01:00
parent 9c71d75363
commit 4369735976
9 changed files with 39 additions and 27 deletions

View File

@ -24,7 +24,7 @@ in
./dns.nix ./dns.nix
./prowlarr.nix ./prowlarr.nix
./redlib.nix ./redlib.nix
./jellyfin.nix # ./jellyfin.nix
./tailscale.nix ./tailscale.nix
./headscale.nix ./headscale.nix
./llm.nix ./llm.nix
@ -146,7 +146,7 @@ in
type = "lan"; type = "lan";
net = "10.0.0.0/24"; net = "10.0.0.0/24";
devices = { devices = {
architect = { address = "10.0.0.250"; hostname = "architect.${domain}"; }; architect = { address = "10.0.0.250"; hostname = "architect.${domain}"; isEndpoint = true; };
brigettine = { address = "10.0.0.1"; hostname = "router.${domain}"; }; brigettine = { address = "10.0.0.1"; hostname = "router.${domain}"; };
dreamel10 = { address = "10.0.0.199"; hostname = "dreamel10.${domain}"; }; dreamel10 = { address = "10.0.0.199"; hostname = "dreamel10.${domain}"; };
reolinkcamera = { address = "10.0.0.200"; hostname = "reolinkcamera.${domain}"; }; reolinkcamera = { address = "10.0.0.200"; hostname = "reolinkcamera.${domain}"; };
@ -178,6 +178,31 @@ in
domain = "htrad.giugl.io"; domain = "htrad.giugl.io";
package = pkgs.unstablePkgs.radarr; package = pkgs.unstablePkgs.radarr;
}; };
sonarr = {
enable = true;
domain = "htson.giugl.io";
package = pkgs.unstablePkgs.sonarr;
};
bazarr = {
enable = true;
domain = "htbaz.giugl.io";
package = pkgs.unstablePkgs.bazarr;
};
nzbget = {
enable = true;
domain = "htnzb.giugl.io";
package = pkgs.unstablePkgs.nzbget;
};
jellyfin = {
enable = true;
domain = "media.giugl.io";
package = pkgs.unstablePkgs.jellyfin;
};
}; };
}; };
} }

View File

@ -5,7 +5,6 @@
pepe.core.dns = { pepe.core.dns = {
enable = true; enable = true;
nextDNSId = "d65174"; nextDNSId = "d65174";
processDomainsFirst = true;
extraDomains = { extraDomains = {
"architect.devs.giugl.io" = { "architect.devs.giugl.io" = {
dnsInterfaces = [ "lan" "tailscale" ]; dnsInterfaces = [ "lan" "tailscale" ];

View File

@ -12,7 +12,7 @@ in
net = "100.64.0.0/10"; net = "100.64.0.0/10";
type = "vpn"; type = "vpn";
devices = { devices = {
architect = { address = "100.64.0.1"; hostname = "architect.${domain}"; }; architect = { address = "100.64.0.1"; hostname = "architect.${domain}"; isEndpoint = true; };
kmerr = { address = "100.64.0.2"; hostname = "kmerr.${domain}"; }; kmerr = { address = "100.64.0.2"; hostname = "kmerr.${domain}"; };
chuck = { address = "100.64.0.4"; hostname = "chuck.${domain}"; }; chuck = { address = "100.64.0.4"; hostname = "chuck.${domain}"; };
dodino = { address = "100.64.0.5"; hostname = "dodino.${domain}"; }; dodino = { address = "100.64.0.5"; hostname = "dodino.${domain}"; };

View File

@ -42,7 +42,9 @@ in
generateDomainConfig = domain: conf: ifaceName: generateDomainConfig = domain: conf: ifaceName:
let let
iface = config.pepe.core.network.interfaces.${ifaceName}; iface = config.pepe.core.network.interfaces.${ifaceName};
serverIP = iface.devices.server.address or "127.0.0.1";
ifaceEndpoint = lib.head (lib.attrNames (lib.filterAttrs (_: device: device.isEndpoint) iface.devices));
serverIP = iface.devices.${ifaceEndpoint}.address;
interfaceNet = iface.net; interfaceNet = iface.net;
in in
'' ''
@ -73,9 +75,7 @@ in
({ name, device }: ({ name, device }:
let let
deviceIP = device.address; deviceIP = device.address;
serverName = if device.dnsServerName != "" serverName = "${name}-${cfg.nextDNSId}.dns.nextdns.io";
then device.dnsServerName
else "${name}-${cfg.nextDNSId}.dns.nextdns.io";
in in
'' ''
. { . {
@ -124,9 +124,7 @@ in
. { . {
forward . tls://45.90.28.77 tls://45.90.30.77 { forward . tls://45.90.28.77 tls://45.90.30.77 {
tls_servername ${if (lib.length (lib.attrNames config.pepe.core.network.dnsEndpoints)) > 0 tls_servername "lan-${cfg.nextDNSId}.dns.nextdns.io"
then (lib.head (lib.attrValues config.pepe.core.network.dnsEndpoints)).serverName
else "lan-${cfg.nextDNSId}.dns.nextdns.io"}
health_check 5s health_check 5s
} }
} }

View File

@ -37,17 +37,11 @@ in
description = "The hostname of the device."; description = "The hostname of the device.";
}; };
isDnsEndpoint = mkOption { isEndpoint = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Whether this device serves as a DNS endpoint for this interface."; description = "Whether this device serves as a DNS endpoint for this interface.";
}; };
dnsServerName = mkOption {
type = types.str;
default = "";
description = "DNS server name for TLS connections (e.g., 'device-id.dns.nextdns.io').";
};
}; };
}); });
default = { }; default = { };

View File

@ -22,8 +22,7 @@ in
group = "media"; group = "media";
}; };
pepe.core.vhost.hosts.${cfg.domain} = with config.pepe.core.network; { pepe.core.vhost.hosts.${cfg.domain} = {
dnsInterfaces = [ interfaceTypes.vpn ];
locations."/" = { locations."/" = {
port = 6767; port = 6767;
allowLAN = true; allowLAN = true;

View File

@ -24,8 +24,7 @@ in
# needed since StateDirectory does not accept symlinks # needed since StateDirectory does not accept symlinks
systemd.services.jellyfin.serviceConfig.StateDirectory = mkForce ""; systemd.services.jellyfin.serviceConfig.StateDirectory = mkForce "";
pepe.core.vhost.hosts.${cfg.domain} = with config.pepe.core.network; { pepe.core.vhost.hosts.${cfg.domain} = {
dnsInterfaces = [ interfaceTypes.lan interfaceTypes.vpn ];
locations = { locations = {
"/" = { "/" = {
port = 8096; port = 8096;

View File

@ -22,8 +22,7 @@ in
group = "media"; group = "media";
}; };
pepe.core.vhost.hosts.${cfg.domain} = with config.pepe.core.network; { pepe.core.vhost.hosts.${cfg.domain} = {
dnsInterfaces = [ interfaceTypes.vpn interfaceTypes.lan ];
locations."/" = { locations."/" = {
port = 6789; port = 6789;
allowLAN = true; allowLAN = true;

View File

@ -21,8 +21,7 @@ in
package = cfg.package; package = cfg.package;
}; };
pepe.core.vhost.hosts.${cfg.domain} = with config.pepe.core.network; { pepe.core.vhost.hosts.${cfg.domain} = {
dnsInterfaces = [ interfaceTypes.vpn interfaceTypes.lan ];
locations."/" = { locations."/" = {
port = 8989; port = 8989;
allowLAN = true; allowLAN = true;