me like nix
1{ inputs, ... }:
2
3let
4 jellyfinKodiSyncQueue = inputs.nixpkgs.legacyPackages.x86_64-linux.fetchzip {
5 url = "https://repo.jellyfin.org/releases/plugin/kodi-sync-queue/kodi-sync-queue_15.0.0.0.zip";
6 stripRoot = false;
7 hash = "sha256-xtlG3UQ/WClt/Hvxe+oId2CeJ+PWMDXBUJXh5+k+mZQ=";
8 };
9in
10{
11 flake.modules.nixos.media-server =
12 { pkgs, config, lib, ... }:
13 {
14 services.flaresolverr.enable = true;
15
16 services.immich = {
17 enable = true;
18 mediaLocation = "/mnt/storage2/immich";
19 host = "0.0.0.0";
20 openFirewall = true;
21 };
22
23 # Immich uses PostgreSQL via Unix socket; avoid conflicting with lbdt-postgres on TCP/5432.
24 services.postgresql.settings.listen_addresses = lib.mkForce "";
25
26 age.secrets.wireguard.file = ../secrets/wireguard.age;
27
28 nixarr = {
29 enable = true;
30 mediaDir = "/mnt/storage1/nixarr/media";
31 vpn = {
32 enable = true;
33 wgConf = config.age.secrets.wireguard.path;
34 };
35
36 jellyfin = {
37 enable = true;
38 openFirewall = true;
39 };
40
41 transmission = {
42 enable = true;
43 vpn.enable = true;
44 peerPort = 51413;
45 };
46 sabnzbd = {
47 enable = true;
48 vpn.enable = true;
49 openFirewall = true;
50 };
51
52 prowlarr.enable = true;
53 radarr.enable = true;
54 sonarr.enable = true;
55 seerr = {
56 enable = true;
57 openFirewall = true;
58 };
59
60 recyclarr = {
61 enable = true;
62 configuration = {
63 sonarr = {
64 series = {
65 base_url = "http://localhost:8989";
66 api_key = "!env_var SONARR_API_KEY";
67 quality_definition = {
68 type = "series";
69 };
70 delete_old_custom_formats = true;
71 custom_formats = [
72 {
73 trash_ids = [
74 "85c61753df5da1fb2aab6f2a47426b09"
75 "9c11cd3f07101cdba90a2d81cf0e56b4"
76 ];
77 assign_scores_to = [
78 {
79 name = "WEB-DL (1080p)";
80 score = -10000;
81 }
82 ];
83 }
84 ];
85 };
86 };
87 radarr = {
88 movies = {
89 base_url = "http://localhost:7878";
90 api_key = "!env_var RADARR_API_KEY";
91 quality_definition = {
92 type = "movie";
93 };
94 delete_old_custom_formats = true;
95 custom_formats = [
96 {
97 trash_ids = [
98 "570bc9ebecd92723d2d21500f4be314c"
99 "eca37840c13c6ef2dd0262b141a5482f"
100 ];
101 assign_scores_to = [
102 {
103 name = "HD Bluray + WEB";
104 score = 25;
105 }
106 ];
107 }
108 ];
109 };
110 };
111 };
112 };
113 };
114
115 # Avoid jellyfin blocking shutdown for 2 minutes
116 systemd.services.jellyfin.serviceConfig.TimeoutStopSec = 10;
117
118 # Install Kodi Sync Queue plugin into Jellyfin
119 systemd.services.jellyfin.serviceConfig.ExecStartPre =
120 let
121 pluginDir = "/data/.state/nixarr/jellyfin/data/plugins/Kodi Sync Queue/15.0.0.0";
122 in
123 pkgs.writeShellScript "install-jellyfin-plugins" ''
124 mkdir -p "${pluginDir}"
125 cp -f ${jellyfinKodiSyncQueue}/*.dll ${jellyfinKodiSyncQueue}/meta.json "${pluginDir}/"
126 '';
127 };
128}