Compare commits

...

2 Commits

Author SHA1 Message Date
306e320a3a create 'lib.vpnNamespaceOpenPort' 2025-08-20 12:28:48 -04:00
c272eb9d5b qbt: cleanup 2025-08-20 12:23:30 -04:00
3 changed files with 34 additions and 40 deletions

21
lib.nix
View File

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

View File

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

View File

@@ -11,31 +11,15 @@
(lib.serviceMountDeps "qbittorrent" [ (lib.serviceMountDeps "qbittorrent" [
service_configs.torrents_path service_configs.torrents_path
config.services.qbittorrent.serverConfig.Preferences.Downloads.TempPath config.services.qbittorrent.serverConfig.Preferences.Downloads.TempPath
"/var/lib/qBittorrent/qBittorrent" "${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 = { services.qbittorrent = {
enable = true; enable = true;
package = pkgs.qbittorrent-nox;
webuiPort = service_configs.ports.torrent; webuiPort = service_configs.ports.torrent;
profileDir = "/var/lib/qBittorrent";
serverConfig.LegalNotice.Accepted = true; serverConfig.LegalNotice.Accepted = true;
@@ -44,8 +28,8 @@
AlternativeUIEnabled = true; AlternativeUIEnabled = true;
RootFolder = builtins.toString ( RootFolder = builtins.toString (
pkgs.fetchzip { pkgs.fetchzip {
url = "https://github.com/VueTorrent/VueTorrent/releases/download/v2.26.0/vuetorrent.zip"; url = "https://github.com/VueTorrent/VueTorrent/releases/download/v2.28.2/vuetorrent.zip";
sha256 = "EFVzsr/OZ/QMJ+NN3kDkmIk6FCCnqgK6DgsLWNonspU="; sha256 = "8aKmiXcr2pp8qt4w/lYBAIjLPh8tlgYsx6PbovY54KM=";
} }
); );
@@ -55,8 +39,7 @@
}; };
Downloads = { Downloads = {
SavePath = service_configs.torrent.SavePath; inherit (service_configs.torrent) SavePath TempPath;
TempPath = service_configs.torrent.TempPath;
}; };
}; };
@@ -67,7 +50,7 @@
IgnoreLimitsOnLAN = true; IgnoreLimitsOnLAN = true;
IncludeOverheadInLimits = true; IncludeOverheadInLimits = false;
GlobalMaxRatio = 6.0; GlobalMaxRatio = 6.0;
QueueingSystemEnabled = false; # seed all torrents all the time QueueingSystemEnabled = false; # seed all torrents all the time
@@ -201,7 +184,7 @@
AnnounceToAllTrackers = true; AnnounceToAllTrackers = true;
# idk why it also has to be specified here too? # idk why it also has to be specified here too?
TempPath = config.services.qbittorrent.serverConfig.Preferences.Downloads.TempPath; inherit (config.services.qbittorrent.serverConfig.Preferences.Downloads) TempPath;
TempPathEnabled = true; TempPathEnabled = true;
# how many connections per sec # how many connections per sec
@@ -217,6 +200,7 @@
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d ${config.services.qbittorrent.serverConfig.Preferences.Downloads.SavePath} 0750 ${config.services.qbittorrent.user} ${service_configs.media_group}" "d ${config.services.qbittorrent.serverConfig.Preferences.Downloads.SavePath} 0750 ${config.services.qbittorrent.user} ${service_configs.media_group}"
"d ${config.services.qbittorrent.serverConfig.Preferences.Downloads.TempPath} 0750 ${config.services.qbittorrent.user} ${service_configs.media_group}" "d ${config.services.qbittorrent.serverConfig.Preferences.Downloads.TempPath} 0750 ${config.services.qbittorrent.user} ${service_configs.media_group}"
"d ${config.services.qbittorrent.profileDir} 0700 ${config.services.qbittorrent.user} ${config.services.qbittorrent.group}"
]; ];
# make qbittorrent use a vpn # make qbittorrent use a vpn