feat: add nix module for arr suite
Can finally deploy: * Jellyfin * Jellyseerr * Radarr, Prowlarr, Sonarr, Bazarr * QBitTorrent + VueTorrent Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
parent
73cd391baf
commit
3408ceb62c
18
modules/nixos/services/arr/bazarr/default.nix
Normal file
18
modules/nixos/services/arr/bazarr/default.nix
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
options.snowflake.services.bazarr = {
|
||||||
|
enable = lib.mkEnableOption "Enable bazarr deployment configuration";
|
||||||
|
};
|
||||||
|
|
||||||
|
# NOTE: No good subtitle providers are available right now.
|
||||||
|
# There's no need to enable bazarr, private trackers have decent
|
||||||
|
# subtitles for releases.
|
||||||
|
config = lib.mkIf config.snowflake.services.bazarr.enable {
|
||||||
|
services.bazarr.enable = true;
|
||||||
|
services.bazarr.group = "media";
|
||||||
|
services.bazarr.openFirewall = true;
|
||||||
|
};
|
||||||
|
}
|
@ -1,51 +1,32 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
options.snowflake.services.arr = {
|
options.snowflake.services.arr = {
|
||||||
enable = lib.mkEnableOption "Enable arr suite configuration";
|
enable = lib.mkEnableOption "Enable arr suite configuration";
|
||||||
jellyfin.enable = lib.mkEnableOption "Enable jellyfin configuration for NixOS";
|
monitoring = {
|
||||||
# mediaDir = lib.mkOption {
|
enable = lib.mkEnableOption "Enable monitoring for arr suite";
|
||||||
# type = lib.types.path;
|
sonarrApiKeyFile = lib.mkOption {
|
||||||
# description = "Path to media storage directory, accessible by all *arr suite applications";
|
description = "Age module containing the sonarr API Key to use for monitoring";
|
||||||
# };
|
};
|
||||||
|
radarrApiKeyFile = lib.mkOption {
|
||||||
|
description = "Age module containing the radarr API Key to use for monitoring";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config = lib.mkIf config.snowflake.services.arr.enable {
|
||||||
cfg = config.snowflake.services.arr;
|
snowflake.services = {
|
||||||
in
|
jellyfin.enable = true;
|
||||||
lib.mkIf cfg.enable {
|
jellyseerr.enable = true;
|
||||||
services.jellyfin = {
|
radarr.enable = true;
|
||||||
enable = cfg.jellyfin.enable;
|
sonarr.enable = true;
|
||||||
|
prowlarr.enable = true;
|
||||||
|
qbittorrent-nox = {
|
||||||
|
enable = true;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
users.groups.media = {
|
|
||||||
members = ["@wheel" "jellyfin"];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.config.packageOverrides = pkgs: {
|
|
||||||
jellyfin-ffmpeg = pkgs.jellyfin-ffmpeg.override {
|
|
||||||
ffmpeg_6-full = pkgs.ffmpeg_6-full.override {
|
|
||||||
withMfx = false;
|
|
||||||
withVpl = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
hardware.graphics = {
|
|
||||||
enable = true;
|
|
||||||
extraPackages = with pkgs; [
|
|
||||||
intel-media-driver
|
|
||||||
intel-compute-runtime
|
|
||||||
onevpl-intel-gpu
|
|
||||||
libvdpau-va-gl
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
services.jellyseerr.enable = true;
|
|
||||||
services.jellyseerr.openFirewall = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
66
modules/nixos/services/arr/jellyfin/default.nix
Normal file
66
modules/nixos/services/arr/jellyfin/default.nix
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
options.snowflake.services.jellyfin = {
|
||||||
|
enable = lib.mkEnableOption "Enable jellyfin deployment configuration";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = let
|
||||||
|
cfg = config.snowflake.services.jellyfin;
|
||||||
|
in
|
||||||
|
lib.mkIf cfg.enable {
|
||||||
|
services.jellyfin = {
|
||||||
|
enable = true;
|
||||||
|
openFirewall = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups.media = {
|
||||||
|
members = ["@wheel" "jellyfin"];
|
||||||
|
};
|
||||||
|
|
||||||
|
nixpkgs.config.packageOverrides = pkgs: {
|
||||||
|
jellyfin-ffmpeg = pkgs.jellyfin-ffmpeg.override {
|
||||||
|
ffmpeg_6-full = pkgs.ffmpeg_6-full.override {
|
||||||
|
withMfx = false;
|
||||||
|
withVpl = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
jellyfin-ffmpeg
|
||||||
|
];
|
||||||
|
|
||||||
|
hardware.graphics = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
intel-media-driver
|
||||||
|
intel-compute-runtime
|
||||||
|
vpl-gpu-rt
|
||||||
|
vaapiIntel
|
||||||
|
vaapiVdpau
|
||||||
|
libvdpau-va-gl
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.jellyseerr.enable = true;
|
||||||
|
services.jellyseerr.openFirewall = true;
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
virtualHosts = {
|
||||||
|
"jelly.deku.moe" = {
|
||||||
|
serverName = "jelly.deku.moe";
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://localhost:8096/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
26
modules/nixos/services/arr/jellyseerr/default.nix
Normal file
26
modules/nixos/services/arr/jellyseerr/default.nix
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
options.snowflake.services.jellyseerr = {
|
||||||
|
enable = lib.mkEnableOption "Enable jellyseerr deployment configuration";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.snowflake.services.jellyseerr.enable {
|
||||||
|
services.jellyseerr.enable = true;
|
||||||
|
services.jellyseerr.openFirewall = true;
|
||||||
|
services.nginx = {
|
||||||
|
virtualHosts = {
|
||||||
|
"seerr.deku.moe" = {
|
||||||
|
serverName = "seerr.deku.moe";
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://localhost:5055/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
14
modules/nixos/services/arr/prowlarr/default.nix
Normal file
14
modules/nixos/services/arr/prowlarr/default.nix
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
options.snowflake.services.prowlarr = {
|
||||||
|
enable = lib.mkEnableOption "Enable prowlarr deployment configuration";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.snowflake.services.prowlarr.enable {
|
||||||
|
services.prowlarr.enable = true;
|
||||||
|
services.prowlarr.openFirewall = true;
|
||||||
|
};
|
||||||
|
}
|
76
modules/nixos/services/arr/qbittorrent/default.nix
Normal file
76
modules/nixos/services/arr/qbittorrent/default.nix
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
options.snowflake.services.qbittorrent-nox = {
|
||||||
|
enable = lib.mkEnableOption "Enable qbittorrent-nox service configuration";
|
||||||
|
|
||||||
|
package = lib.mkPackageOption pkgs "qbittorrent-nox" {};
|
||||||
|
|
||||||
|
openFirewall = lib.mkOption {
|
||||||
|
description = "Allow firewall access for qbittorrent-nox";
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
uiPort = lib.mkOption {
|
||||||
|
description = "Web UI Port for qbittorrent-nox";
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 8069;
|
||||||
|
};
|
||||||
|
|
||||||
|
torrentPort = lib.mkOption {
|
||||||
|
description = "Torrenting port";
|
||||||
|
type = with lib.types; nullOr port;
|
||||||
|
default = 64211;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = let
|
||||||
|
cfg = config.snowflake.services.qbittorrent-nox;
|
||||||
|
in
|
||||||
|
lib.mkIf cfg.enable {
|
||||||
|
networking.firewall.allowedTCPPorts =
|
||||||
|
lib.optional (cfg.openFirewall && cfg.torrentPort != null) cfg.torrentPort
|
||||||
|
++ lib.optional cfg.openFirewall cfg.uiPort;
|
||||||
|
networking.firewall.allowedUDPPorts =
|
||||||
|
lib.optional (cfg.openFirewall && cfg.torrentPort != null) cfg.torrentPort;
|
||||||
|
|
||||||
|
users.users.qbittorrent-nox = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "media";
|
||||||
|
home = "/var/lib/qbittorrent-nox";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.qbittorrent-nox = {
|
||||||
|
description = "qBittorrent-nox service";
|
||||||
|
wants = ["network-online.target"];
|
||||||
|
after = ["local-fs.target" "network-online.target" "nss-lookup.target"];
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
unitConfig.Documentation = "man:qbittorrent-nox(1)";
|
||||||
|
# required for reverse proxying
|
||||||
|
preStart = ''
|
||||||
|
rm -rf /var/lib/qbittorrent-nox/qBittorrent/config/vuetorrent
|
||||||
|
ln -sf ${pkgs.${namespace}.vuetorrent} /var/lib/qbittorrent-nox/qBittorrent/config/vuetorrent
|
||||||
|
|
||||||
|
if [[ ! -f /var/lib/qbittorrent-nox/qBittorrent/config/qBittorrent.conf ]]; then
|
||||||
|
mkdir -p /var/lib/qbittorrent-nox/qBittorrent/config
|
||||||
|
echo "Preferences\WebUI\HostHeaderValidation=false" >> /var/lib/qbittorrent-nox/qBittorrent/config/qBittorrent.conf
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
serviceConfig = {
|
||||||
|
User = "qbittorrent-nox";
|
||||||
|
Group = "media";
|
||||||
|
StateDirectory = "qbittorrent-nox";
|
||||||
|
WorkingDirectory = "/var/lib/qbittorrent-nox";
|
||||||
|
ExecStart = ''
|
||||||
|
${cfg.package}/bin/qbittorrent-nox ${lib.optionalString (cfg.torrentPort != null) "--torrenting-port=${toString cfg.torrentPort}"} \
|
||||||
|
--webui-port=${toString cfg.uiPort} --profile=/var/lib/qbittorrent-nox
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
15
modules/nixos/services/arr/radarr/default.nix
Normal file
15
modules/nixos/services/arr/radarr/default.nix
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
options.snowflake.services.radarr = {
|
||||||
|
enable = lib.mkEnableOption "Enable radarr deployment configuration";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.snowflake.services.radarr.enable {
|
||||||
|
services.radarr.enable = true;
|
||||||
|
services.radarr.group = "media";
|
||||||
|
services.radarr.openFirewall = true;
|
||||||
|
};
|
||||||
|
}
|
15
modules/nixos/services/arr/sonarr/default.nix
Normal file
15
modules/nixos/services/arr/sonarr/default.nix
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
options.snowflake.services.sonarr = {
|
||||||
|
enable = lib.mkEnableOption "Enable sonarr deployment configuration";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.snowflake.services.sonarr.enable {
|
||||||
|
services.sonarr.enable = true;
|
||||||
|
services.sonarr.group = "media";
|
||||||
|
services.sonarr.openFirewall = true;
|
||||||
|
};
|
||||||
|
}
|
35
packages/vuetorrent/default.nix
Normal file
35
packages/vuetorrent/default.nix
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "vuetorrent";
|
||||||
|
version = "2.10.2";
|
||||||
|
|
||||||
|
src = pkgs.fetchurl {
|
||||||
|
url = "https://github.com/WDaan/VueTorrent/releases/download/v${version}/vuetorrent.zip";
|
||||||
|
sha256 = "sha256-pJzj3jHXmpKca1zyOTlzUQvp7/LtjjMGNt9SMDo89yo=";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [unzip];
|
||||||
|
|
||||||
|
unpackPhase = ''
|
||||||
|
unzip $src
|
||||||
|
'';
|
||||||
|
|
||||||
|
dontStrip = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/
|
||||||
|
cp -r vuetorrent/public/ $out/
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "The sleekest looking WEBUI for qBittorrent made with Vuejs! ";
|
||||||
|
homepage = "https://github.com/WDaan/VueTorrent";
|
||||||
|
license = [licenses.gpl3Only];
|
||||||
|
platforms = ["x86_64-darwin" "aarch64-darwin" "aarch64-linux" "x86_64-linux"];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user