modularizing of vps ips

This commit is contained in:
Danilo Reyes 2025-09-16 14:56:42 -06:00
parent cfca87a703
commit 17b2d98b6c
8 changed files with 29 additions and 16 deletions

View File

@ -123,7 +123,6 @@
"ai.cachix.org-1:N9dzRK+alWwoKXQlnn0H6aUx0lU/mspIoz8hMvGvbbc="
"cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o="
"cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
"cache.servidos.lat:om+P81I+m8Hawcvt1ydaSNVxGNnR0POJ8Wz+QVjQ3hA="
];
};
};

View File

@ -5,7 +5,7 @@
../../config/base.nix
../../config/stylix.nix
];
my = import ./toggles.nix;
my = import ./toggles.nix { inherit config; };
sops.secrets."vps/home/private".sopsFile = ../../secrets/wireguard.yaml;
networking =
let
@ -42,13 +42,13 @@
interfaces.wg0.allowedTCPPorts = [ 8081 ];
};
wireguard.interfaces.wg0 = {
ips = [ "10.77.0.2/32" ];
ips = [ "${config.my.wgServerIp}/32" ];
privateKeyFile = config.sops.secrets."vps/home/private".path;
peers = [
{
publicKey = "dFbiSekBwnZomarcS31o5+w6imHjMPNCipkfc2fZ3GY=";
endpoint = "51.222.141.104:51820";
allowedIPs = [ "10.77.0.1/32" ];
allowedIPs = [ "${config.my.wgVpsIp}/32" ];
persistentKeepalive = 25;
}
];

View File

@ -1,3 +1,4 @@
{ config }:
let
mkEnabled = name: {
inherit name;
@ -7,7 +8,7 @@ let
inherit name;
value = {
enable = true;
ip = "10.77.0.2";
ip = config.my.wgServerIp;
};
};
mkEnabledProxy = name: {
@ -86,7 +87,6 @@ in
"plex"
"prowlarr"
"radarr"
"readeck"
"ryot"
"sonarr"
"synapse"
@ -95,5 +95,6 @@ in
// enableList mkEnabledIp [
"audiobookshelf"
"vaultwarden"
"readeck"
];
}

View File

@ -40,7 +40,17 @@ in
default = "::1";
description = "The localhost ipv6 address.";
};
routerip = lib.mkOption {
wgVpsIp = lib.mkOption {
type = lib.types.str;
default = "10.77.0.1";
description = "The ip address of my router.";
};
wgServerIp = lib.mkOption {
type = lib.types.str;
default = "10.77.0.2";
description = "The ip address of my router.";
};
routerIp = lib.mkOption {
type = lib.types.str;
default = "192.168.100.1";
description = "The ip address of my router.";

View File

@ -196,7 +196,7 @@
icon = "${cfg.name}.png";
href = cfg.url;
widget = {
url = "http://10.77.0.2:8081";
url = "http://${config.my.wgServerIp}:8081";
type = cfg.name;
username = "{{HOMEPAGE_VAR_NEXTCLOUD_USERNAME}}";
password = "{{HOMEPAGE_VAR_NEXTCLOUD_PASSWORD}}";

View File

@ -126,14 +126,14 @@ in
trusted_proxies = [
config.my.localhost
config.my.localhost6
config.my.routerip
"10.77.0.1" # vps
config.my.routerIp
config.my.wgVpsIp
];
trusted_domains = [
cfg.host
config.my.ips.${config.networking.hostName}
"localhost"
"cloud.rotehaare.art"
"cloud.servidos.lat"
];
overwriteprotocol = "https";
"overwrite.cli.url" = "${cfg.url}";
@ -180,11 +180,11 @@ in
#vps
listen = [
{
addr = "10.77.0.2";
addr = config.my.wgServerIp;
port = 8081;
}
{
addr = "127.0.0.1";
addr = config.my.localhost;
port = 8081;
}
];
@ -257,7 +257,7 @@ in
environment = {
TZ = config.my.timeZone;
domain = cfg.host;
aliasgroup1 = "cloud.servidos.lat:443";
aliasgroup1 = "${cfg.host}:443";
aliasgroup2 = "cloud.rotehaare.art:443";
dictionaries = "en_CA en_US es_MX es_ES fr_FR it pt_BR ru";
extra_params = ''

View File

@ -16,7 +16,10 @@ in
log_level = "warn";
data_directory = "/var/lib/readeck";
};
server.port = cfg.port;
server = {
port = cfg.port;
host = cfg.ip;
};
};
};
nginx.virtualHosts."${cfg.host}" = lib.mkIf cfg.enableProxy (setup.proxyReverse cfg);

View File

@ -59,7 +59,7 @@ in
bind_addresses = [
config.my.localhost
config.my.localhost6
"10.77.0.2"
config.my.wgServerIp
];
type = "http";
tls = false;