Added bazarr
This commit is contained in:
@@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.nixarr.bazarr;
|
||||||
|
nixarr = config.nixarr;
|
||||||
|
in {
|
||||||
|
options.nixarr.bazarr = {
|
||||||
|
enable = mkEnableOption "the bazarr service.";
|
||||||
|
|
||||||
|
stateDir = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "${nixarr.stateDir}/bazarr";
|
||||||
|
defaultText = literalExpression ''"''${nixarr.stateDir}/bazarr"'';
|
||||||
|
example = "/home/user/.local/share/nixarr/bazarr";
|
||||||
|
description = "The state directory for bazarr";
|
||||||
|
};
|
||||||
|
|
||||||
|
vpn.enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = ''
|
||||||
|
**Required options:** [`nixarr.vpn.enable`](#nixarr.vpn.enable)
|
||||||
|
|
||||||
|
Route Bazarr traffic through the VPN.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.vpn.enable -> nixarr.vpn.enable;
|
||||||
|
message = ''
|
||||||
|
The nixarr.bazarr.vpn.enable option requires the
|
||||||
|
nixarr.vpn.enable option to be set, but it was not.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d '${cfg.stateDir}' 0700 bazarr root - -"
|
||||||
|
];
|
||||||
|
|
||||||
|
services.bazarr = {
|
||||||
|
enable = cfg.enable;
|
||||||
|
user = "bazarr";
|
||||||
|
group = "media";
|
||||||
|
dataDir = cfg.stateDir;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable and specify VPN namespace to confine service in.
|
||||||
|
systemd.services.bazarr.vpnconfinement = mkIf cfg.vpn.enable {
|
||||||
|
enable = true;
|
||||||
|
vpnnamespace = "wg";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Port mappings
|
||||||
|
# TODO: openports
|
||||||
|
vpnnamespaces.wg = mkIf cfg.vpn.enable {
|
||||||
|
portMappings = [{ from = config.bazarr.listenPort; to = config.bazarr.listenPort; }];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx = mkIf cfg.vpn.enable {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
recommendedTlsSettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
|
||||||
|
virtualHosts."127.0.0.1:${builtins.toString config.bazarr.listenPort}" = {
|
||||||
|
listen = [
|
||||||
|
{
|
||||||
|
addr = "0.0.0.0";
|
||||||
|
port = config.bazarr.listenPort;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
locations."/" = {
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
proxyWebsockets = true;
|
||||||
|
proxyPass = "http://192.168.15.1:${builtins.toString config.bazarr.listenPort}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.nixarr.lidarr;
|
cfg = config.nixarr.lidarr;
|
||||||
nixarr = config.nixarr;
|
nixarr = config.nixarr;
|
||||||
|
defaultPort = 8686;
|
||||||
in {
|
in {
|
||||||
options.nixarr.lidarr = {
|
options.nixarr.lidarr = {
|
||||||
enable = mkEnableOption "the Lidarr service.";
|
enable = mkEnableOption "the Lidarr service.";
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ with lib; let
|
|||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./jellyfin
|
./jellyfin
|
||||||
|
./bazarr
|
||||||
./ddns
|
./ddns
|
||||||
./radarr
|
./radarr
|
||||||
./lidarr
|
./lidarr
|
||||||
@@ -53,6 +54,7 @@ in {
|
|||||||
The following services are supported:
|
The following services are supported:
|
||||||
|
|
||||||
- [Jellyfin](#nixarr.jellyfin.enable)
|
- [Jellyfin](#nixarr.jellyfin.enable)
|
||||||
|
- [Bazarr](#nixarr.bazarr.enable)
|
||||||
- [Lidarr](#nixarr.lidarr.enable)
|
- [Lidarr](#nixarr.lidarr.enable)
|
||||||
- [Prowlarr](#nixarr.prowlarr.enable)
|
- [Prowlarr](#nixarr.prowlarr.enable)
|
||||||
- [Radarr](#nixarr.radarr.enable)
|
- [Radarr](#nixarr.radarr.enable)
|
||||||
|
|||||||
Reference in New Issue
Block a user