make sabnzbd gui port a user option
This commit is contained in:
@@ -6,7 +6,6 @@
|
|||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.nixarr.sabnzbd;
|
cfg = config.nixarr.sabnzbd;
|
||||||
defaultPort = 8080;
|
|
||||||
nixarr = config.nixarr;
|
nixarr = config.nixarr;
|
||||||
|
|
||||||
edited-flag = "edited by nixarr";
|
edited-flag = "edited by nixarr";
|
||||||
@@ -22,6 +21,7 @@ with lib; let
|
|||||||
mkINIInitScript = (
|
mkINIInitScript = (
|
||||||
{
|
{
|
||||||
sabnzbd-state-dir,
|
sabnzbd-state-dir,
|
||||||
|
guiPort,
|
||||||
access-externally ? true,
|
access-externally ? true,
|
||||||
whitelist-hosts ? [],
|
whitelist-hosts ? [],
|
||||||
whitelist-ranges ? []
|
whitelist-ranges ? []
|
||||||
@@ -48,6 +48,7 @@ with lib; let
|
|||||||
| initool set - misc download_dir "${nixarr.mediaDir}/usenet/.incomplete" \
|
| initool set - misc download_dir "${nixarr.mediaDir}/usenet/.incomplete" \
|
||||||
| initool set - misc complete_dir "${nixarr.mediaDir}/usenet/manual" \
|
| initool set - misc complete_dir "${nixarr.mediaDir}/usenet/manual" \
|
||||||
| initool set - misc dirscan_dir "${nixarr.mediaDir}/usenet/.watch" \
|
| initool set - misc dirscan_dir "${nixarr.mediaDir}/usenet/.watch" \
|
||||||
|
| initool set - misc port "${builtins.toString guiPort}" \
|
||||||
'' +
|
'' +
|
||||||
|
|
||||||
# set host to 0.0.0.0 if remote access needed
|
# set host to 0.0.0.0 if remote access needed
|
||||||
@@ -95,6 +96,15 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
guiPort = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = 8080;
|
||||||
|
example = 9999;
|
||||||
|
description = ''
|
||||||
|
The port that SABnzbd's GUI will listen on for incomming connections.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
openFirewall = mkOption {
|
openFirewall = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
defaultText = literalExpression ''!nixarr.SABnzbd.vpn.enable'';
|
defaultText = literalExpression ''!nixarr.SABnzbd.vpn.enable'';
|
||||||
@@ -163,13 +173,14 @@ in {
|
|||||||
configFile = "${cfg.stateDir}/sabnzbd.ini";
|
configFile = "${cfg.stateDir}/sabnzbd.ini";
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ defaultPort ];
|
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.guiPort ];
|
||||||
|
|
||||||
systemd.services.sabnzbd.serviceConfig = {
|
systemd.services.sabnzbd.serviceConfig = {
|
||||||
ExecStartPre = mkBefore [
|
ExecStartPre = mkBefore [
|
||||||
(
|
(
|
||||||
"+" + mkINIInitScript {
|
"+" + mkINIInitScript {
|
||||||
sabnzbd-state-dir = cfg.stateDir;
|
sabnzbd-state-dir = cfg.stateDir;
|
||||||
|
guiPort = cfg.guiPort;
|
||||||
access-externally = cfg.openFirewall;
|
access-externally = cfg.openFirewall;
|
||||||
whitelist-hosts = cfg.whitelistHostnames;
|
whitelist-hosts = cfg.whitelistHostnames;
|
||||||
whitelist-ranges = cfg.whitelistRanges;
|
whitelist-ranges = cfg.whitelistRanges;
|
||||||
@@ -214,8 +225,8 @@ in {
|
|||||||
vpnnamespaces.wg = mkIf cfg.vpn.enable {
|
vpnnamespaces.wg = mkIf cfg.vpn.enable {
|
||||||
portMappings = [
|
portMappings = [
|
||||||
{
|
{
|
||||||
from = defaultPort;
|
from = cfg.guiPort;
|
||||||
to = defaultPort;
|
to = cfg.guiPort;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
@@ -227,17 +238,17 @@ in {
|
|||||||
recommendedOptimisation = true;
|
recommendedOptimisation = true;
|
||||||
recommendedGzipSettings = true;
|
recommendedGzipSettings = true;
|
||||||
|
|
||||||
virtualHosts."127.0.0.1:${builtins.toString defaultPort}" = {
|
virtualHosts."127.0.0.1:${builtins.toString cfg.guiPort}" = {
|
||||||
listen = [
|
listen = [
|
||||||
{
|
{
|
||||||
addr = "0.0.0.0";
|
addr = "0.0.0.0";
|
||||||
port = defaultPort;
|
port = cfg.guiPort;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
proxyPass = "http://192.168.15.1:${builtins.toString defaultPort}";
|
proxyPass = "http://192.168.15.1:${builtins.toString cfg.guiPort}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user