Updated docs and removed some superflous statedirs from systemd-tmpfiles

This commit is contained in:
rasmus-kirk
2024-03-12 23:29:56 +01:00
parent 96fffa452d
commit 83e3246489
10 changed files with 152 additions and 62 deletions
+3 -1
View File
@@ -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;
+13 -2
View File
@@ -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 {
+14 -7
View File
@@ -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 = {
+14 -7
View File
@@ -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";
+20 -2
View File
@@ -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`.
'';
};
+22 -15
View File
@@ -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 = {
+14 -7
View File
@@ -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";
+14 -7
View File
@@ -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";
+14 -7
View File
@@ -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";
+24 -7
View File
@@ -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;