create 'lib.vpnNamespaceOpenPort'

This commit is contained in:
Simon Gardling 2025-08-20 12:28:13 -04:00
parent c272eb9d5b
commit 306e320a3a
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
3 changed files with 26 additions and 32 deletions

21
lib.nix
View File

@ -54,5 +54,26 @@ inputs.nixpkgs.lib.extend (
"-march=znver3"
"-mtune=znver3"
];
vpnNamespaceOpenPort =
port:
{ ... }:
{
vpnNamespaces.wg = {
portMappings = [
{
from = port;
to = port;
}
];
openVPNPorts = [
{
port = port;
protocol = "both";
}
];
};
};
}
)

View File

@ -2,25 +2,14 @@
pkgs,
service_configs,
config,
lib,
...
}:
{
vpnNamespaces.wg = {
portMappings = [
{
from = service_configs.ports.bitmagnet;
to = service_configs.ports.bitmagnet;
}
imports = [
(lib.vpnNamespaceOpenPort service_configs.ports.bitmagnet)
];
openVPNPorts = [
{
port = service_configs.ports.bitmagnet;
protocol = "both";
}
];
};
services.bitmagnet = {
enable = true;

View File

@ -13,25 +13,9 @@
config.services.qbittorrent.serverConfig.Preferences.Downloads.TempPath
"${config.services.qbittorrent.profileDir}/qBittorrent"
])
(lib.vpnNamespaceOpenPort config.services.qbittorrent.webuiPort)
];
# network namespace that is proxied through mullvad
vpnNamespaces.wg = {
portMappings = [
{
from = config.services.qbittorrent.webuiPort;
to = config.services.qbittorrent.webuiPort;
}
];
openVPNPorts = [
{
port = config.services.qbittorrent.webuiPort;
protocol = "both";
}
];
};
services.qbittorrent = {
enable = true;
webuiPort = service_configs.ports.torrent;