diff --git a/README.md b/README.md index 5c722a1..7bac7f5 100644 --- a/README.md +++ b/README.md @@ -107,12 +107,13 @@ This example does the following: enable = true; # These two values are also the default, but you can set them to whatever # else you want + # WARNING: Do _not_ set them to `/home/user/whatever`, it will not work! mediaDir = "/data/media"; stateDir = "/data/media/.state/nixarr"; vpn = { enable = true; - # IMPORTANT: This file must _not_ be in the config git directory + # WARNING: This file must _not_ be in the config git directory # You can usually get this wireguard file from your VPN provider wgConf = "/data/.secret/wg.conf"; }; @@ -136,6 +137,7 @@ This example does the following: # It is possible for this module to run the *Arrs through a VPN, but it # is generally not recommended, as it can cause rate-limiting issues. + bazarr.enable = true; sonarr.enable = true; radarr.enable = true; prowlarr.enable = true; diff --git a/nixarr/bazarr/default.nix b/nixarr/bazarr/default.nix index a6669b6..efbbb6d 100644 --- a/nixarr/bazarr/default.nix +++ b/nixarr/bazarr/default.nix @@ -18,7 +18,7 @@ in { type = types.path; default = "${nixarr.stateDir}/bazarr"; defaultText = literalExpression ''"''${nixarr.stateDir}/bazarr"''; - example = "/home/user/.local/share/nixarr/bazarr"; + example = "/nixarr/.state/bazarr"; description = "The state directory for bazarr"; }; diff --git a/nixarr/jellyfin/default.nix b/nixarr/jellyfin/default.nix index 09990f0..6839f98 100644 --- a/nixarr/jellyfin/default.nix +++ b/nixarr/jellyfin/default.nix @@ -14,8 +14,8 @@ in with lib; { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/jellyfin"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/jellyfin"; + defaultText = literalExpression ''"''${nixarr.stateDir}/jellyfin"''; + example = "/nixarr/.state/jellyfin"; description = "The state directory for Jellyfin."; }; @@ -170,10 +170,6 @@ in with lib; { systemd.tmpfiles.rules = [ "d '${cfg.stateDir}' 0700 streamer root - -" - "d '${cfg.stateDir}/log' 0700 streamer root - -" - "d '${cfg.stateDir}/cache' 0700 streamer root - -" - "d '${cfg.stateDir}/data' 0700 streamer root - -" - "d '${cfg.stateDir}/config' 0700 streamer root - -" ]; services.jellyfin = { diff --git a/nixarr/lidarr/default.nix b/nixarr/lidarr/default.nix index 879fd85..88d35eb 100644 --- a/nixarr/lidarr/default.nix +++ b/nixarr/lidarr/default.nix @@ -14,8 +14,8 @@ in { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/lidarr"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/lidarr"; + defaultText = literalExpression ''"''${nixarr.stateDir}/lidarr"''; + example = "/nixarr/.state/lidarr"; description = "The state directory for Lidarr"; }; @@ -50,10 +50,6 @@ in { } ]; - systemd.tmpfiles.rules = [ - "d '${cfg.stateDir}' 0700 lidarr root - -" - ]; - services.lidarr = { enable = cfg.enable; user = "lidarr"; diff --git a/nixarr/nixarr.nix b/nixarr/nixarr.nix index 20f0521..5ab85a0 100644 --- a/nixarr/nixarr.nix +++ b/nixarr/nixarr.nix @@ -78,18 +78,36 @@ in { mediaDir = mkOption { type = types.path; default = "/data/media"; - example = "/home/user/nixarr"; + example = "/nixarr"; description = '' The location of the media directory for the services. + + **Warning:** Setting this to any path, where the subpath is not + owned by root, will fail! For example: + + ```nix + mediaDir = /home/user/nixarr + ``` + + Is not supported! ''; }; stateDir = mkOption { type = types.path; default = "/data/.state/nixarr"; - example = "/home/user/.local/share/nixarr"; + example = "/nixarr/.state"; description = '' The location of the state directory for the services. + + **Warning:** Setting this to any path, where the subpath is not + owned by root, will fail! For example: + + ```nix + stateDir = /home/user/nixarr/.state + ``` + + Is not supported! ''; }; diff --git a/nixarr/prowlarr/default.nix b/nixarr/prowlarr/default.nix index f6691a6..07482bc 100644 --- a/nixarr/prowlarr/default.nix +++ b/nixarr/prowlarr/default.nix @@ -19,8 +19,8 @@ in { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/prowlarr"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/prowlarr"; + defaultText = literalExpression ''"''${nixarr.stateDir}/prowlarr"''; + example = "/nixarr/.state/prowlarr"; description = "The state directory for Prowlarr."; }; @@ -45,18 +45,14 @@ in { }; config = mkIf cfg.enable { - assertions = [ - { - assertion = cfg.vpn.enable -> nixarr.vpn.enable; - message = '' - The nixarr.prowlarr.vpn.enable option requires the - nixarr.vpn.enable option to be set, but it was not. - ''; - } - ]; - - systemd.tmpfiles.rules = [ - "d '${cfg.stateDir}' 0700 prowlarr root - -" + assertions = [ + { + assertion = cfg.vpn.enable -> nixarr.vpn.enable; + message = '' + The nixarr.prowlarr.vpn.enable option requires the + nixarr.vpn.enable option to be set, but it was not. + ''; + } ]; util-nixarr.services.prowlarr = { diff --git a/nixarr/radarr/default.nix b/nixarr/radarr/default.nix index af984a4..70c8750 100644 --- a/nixarr/radarr/default.nix +++ b/nixarr/radarr/default.nix @@ -15,8 +15,8 @@ in { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/radarr"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/radarr"; + defaultText = literalExpression ''"''${nixarr.stateDir}/radarr"''; + example = "/nixarr/.state/radarr"; description = "The state directory for radarr."; }; @@ -51,10 +51,6 @@ in { } ]; - systemd.tmpfiles.rules = [ - "d '${cfg.stateDir}' 0700 radarr root - -" - ]; - services.radarr = { enable = cfg.enable; user = "radarr"; diff --git a/nixarr/readarr/default.nix b/nixarr/readarr/default.nix index 6ac1fb2..4d4bb00 100644 --- a/nixarr/readarr/default.nix +++ b/nixarr/readarr/default.nix @@ -13,8 +13,8 @@ in { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/readarr"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/readarr"; + defaultText = literalExpression ''"''${nixarr.stateDir}/readarr"''; + example = "/nixarr/.state/readarr"; description = "The state directory for Readarr"; }; @@ -49,10 +49,6 @@ in { } ]; - systemd.tmpfiles.rules = [ - "d '${cfg.stateDir}' 0700 readarr root - -" - ]; - services.readarr = { enable = cfg.enable; user = "readarr"; diff --git a/nixarr/sonarr/default.nix b/nixarr/sonarr/default.nix index bbdfa42..0790c42 100644 --- a/nixarr/sonarr/default.nix +++ b/nixarr/sonarr/default.nix @@ -19,8 +19,8 @@ in { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/sonarr"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/sonarr"; + defaultText = literalExpression ''"''${nixarr.stateDir}/sonarr"''; + example = "/nixarr/.state/sonarr"; description = "The state directory for Sonarr."; }; @@ -55,10 +55,6 @@ in { } ]; - systemd.tmpfiles.rules = [ - "d '${cfg.stateDir}' 0700 sonarr root - -" - ]; - services.sonarr = { enable = cfg.enable; user = "sonarr"; diff --git a/nixarr/transmission/default.nix b/nixarr/transmission/default.nix index 4eb96b5..f5a9f9d 100644 --- a/nixarr/transmission/default.nix +++ b/nixarr/transmission/default.nix @@ -67,8 +67,8 @@ in { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/transmission"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/transmission"; + defaultText = literalExpression ''"''${nixarr.stateDir}/transmission"''; + example = "/nixarr/.state/transmission"; description = '' The state directory for Transmission. ''; @@ -127,9 +127,9 @@ in { type = types.path; default = "${nixarr.stateDir}/cross-seed"; defaultText = literalExpression ''"''${nixarr.stateDir}/cross-seed"''; - example = "/home/user/.local/share/nixarr/cross-seed"; + example = "/nixarr/.state/cross-seed"; description = '' - The state directory for Transmission. + The state directory for cross-seed. ''; }; @@ -235,8 +235,7 @@ in { "d '${cfg.stateDir}' 0750 torrenter torrenter - -" # This is fixes a bug in nixpks (https://github.com/NixOS/nixpkgs/issues/291883) "d '${cfg.stateDir}/.config/transmission-daemon' 0750 torrenter torrenter - -" - ] ++ optional cfg-cross-seed.enable - "d '${cfg-cross-seed.stateDir}' 0700 cross-seed root - -"; + ]; util-nixarr.services.cross-seed = mkIf cfg-cross-seed.enable { enable = true;