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..116709e 100644 --- a/nixarr/bazarr/default.nix +++ b/nixarr/bazarr/default.nix @@ -18,8 +18,19 @@ in { 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"; + example = "/nixarr/.state/bazarr"; + description = '' + The location of the state directory for the Bazarr service. + + **Warning:** Setting this to any path, where the subpath is not + owned by root, will fail! For example: + + ```nix + stateDir = /home/user/nixarr/.state/bazarr + ``` + + Is not supported, because `/home/user` is owned by `user`. + ''; }; openFirewall = mkOption { diff --git a/nixarr/jellyfin/default.nix b/nixarr/jellyfin/default.nix index 09990f0..0a75600 100644 --- a/nixarr/jellyfin/default.nix +++ b/nixarr/jellyfin/default.nix @@ -14,9 +14,20 @@ in with lib; { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/jellyfin"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/jellyfin"; - description = "The state directory for Jellyfin."; + defaultText = literalExpression ''"''${nixarr.stateDir}/jellyfin"''; + example = "/nixarr/.state/jellyfin"; + description = '' + The location of the state directory for the Jellyfin service. + + **Warning:** Setting this to any path, where the subpath is not + owned by root, will fail! For example: + + ```nix + stateDir = /home/user/nixarr/.state/jellyfin + ``` + + Is not supported, because `/home/user` is owned by `user`. + ''; }; openFirewall = mkOption { @@ -170,10 +181,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..ae5fd34 100644 --- a/nixarr/lidarr/default.nix +++ b/nixarr/lidarr/default.nix @@ -14,9 +14,20 @@ in { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/lidarr"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/lidarr"; - description = "The state directory for Lidarr"; + defaultText = literalExpression ''"''${nixarr.stateDir}/lidarr"''; + example = "/nixarr/.state/lidarr"; + description = '' + The location of the state directory for the Lidarr service. + + **Warning:** Setting this to any path, where the subpath is not + owned by root, will fail! For example: + + ```nix + stateDir = /home/user/nixarr/.state/lidarr + ``` + + Is not supported, because `/home/user` is owned by `user`. + ''; }; openFirewall = mkOption { @@ -50,10 +61,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..265c42a 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, because `/home/user` is owned by `user`. ''; }; 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, because `/home/user` is owned by `user`. ''; }; diff --git a/nixarr/prowlarr/default.nix b/nixarr/prowlarr/default.nix index f6691a6..54d1f10 100644 --- a/nixarr/prowlarr/default.nix +++ b/nixarr/prowlarr/default.nix @@ -19,9 +19,20 @@ in { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/prowlarr"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/prowlarr"; - description = "The state directory for Prowlarr."; + defaultText = literalExpression ''"''${nixarr.stateDir}/prowlarr"''; + example = "/nixarr/.state/prowlarr"; + description = '' + The location of the state directory for the Prowlarr service. + + **Warning:** Setting this to any path, where the subpath is not + owned by root, will fail! For example: + + ```nix + stateDir = /home/user/nixarr/.state/prowlarr + ``` + + Is not supported, because `/home/user` is owned by `user`. + ''; }; openFirewall = mkOption { @@ -45,18 +56,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..a55027e 100644 --- a/nixarr/radarr/default.nix +++ b/nixarr/radarr/default.nix @@ -15,9 +15,20 @@ in { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/radarr"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/radarr"; - description = "The state directory for radarr."; + defaultText = literalExpression ''"''${nixarr.stateDir}/radarr"''; + example = "/nixarr/.state/radarr"; + description = '' + The location of the state directory for the Radarr service. + + **Warning:** Setting this to any path, where the subpath is not + owned by root, will fail! For example: + + ```nix + stateDir = /home/user/nixarr/.state/radarr + ``` + + Is not supported, because `/home/user` is owned by `user`. + ''; }; openFirewall = mkOption { @@ -51,10 +62,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..714b357 100644 --- a/nixarr/readarr/default.nix +++ b/nixarr/readarr/default.nix @@ -13,9 +13,20 @@ in { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/readarr"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/readarr"; - description = "The state directory for Readarr"; + defaultText = literalExpression ''"''${nixarr.stateDir}/readarr"''; + example = "/nixarr/.state/readarr"; + description = '' + The location of the state directory for the Readarr service. + + **Warning:** Setting this to any path, where the subpath is not + owned by root, will fail! For example: + + ```nix + stateDir = /home/user/nixarr/.state/readarr + ``` + + Is not supported, because `/home/user` is owned by `user`. + ''; }; openFirewall = mkOption { @@ -49,10 +60,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..8890bad 100644 --- a/nixarr/sonarr/default.nix +++ b/nixarr/sonarr/default.nix @@ -19,9 +19,20 @@ in { stateDir = mkOption { type = types.path; default = "${nixarr.stateDir}/sonarr"; - defaultText = literalExpression ''!cfg.vpn.enable''; - example = "/home/user/.local/share/nixarr/sonarr"; - description = "The state directory for Sonarr."; + defaultText = literalExpression ''"''${nixarr.stateDir}/sonarr"''; + example = "/nixarr/.state/sonarr"; + description = '' + The location of the state directory for the Sonarr service. + + **Warning:** Setting this to any path, where the subpath is not + owned by root, will fail! For example: + + ```nix + stateDir = /home/user/nixarr/.state/sonarr + ``` + + Is not supported, because `/home/user` is owned by `user`. + ''; }; openFirewall = mkOption { @@ -55,10 +66,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..bfea026 100644 --- a/nixarr/transmission/default.nix +++ b/nixarr/transmission/default.nix @@ -67,10 +67,19 @@ 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. + The location of the state directory for the Transmission service. + + **Warning:** Setting this to any path, where the subpath is not + owned by root, will fail! For example: + + ```nix + stateDir = /home/user/nixarr/.state/transmission + ``` + + Is not supported, because `/home/user` is owned by `user`. ''; }; @@ -127,9 +136,18 @@ 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 location of the state directory for the cross-seed service. + + **Warning:** Setting this to any path, where the subpath is not + owned by root, will fail! For example: + + ```nix + stateDir = /home/user/nixarr/.state/cross-seed + ``` + + Is not supported, because `/home/user` is owned by `user`. ''; }; @@ -235,8 +253,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;