Cleaned mkEnableOption mess

This commit is contained in:
rasmus-kirk
2024-02-26 17:57:01 +01:00
parent b49cae6b20
commit 0c61369307
9 changed files with 150 additions and 88 deletions
+4 -2
View File
@@ -24,9 +24,11 @@ in
buildInputs = with pkgs; [pandoc];
phases = ["unpackPhase" "buildPhase"];
buildPhase = ''
tmpdir=$(mktemp -d)
#tmpdir=$(mktemp -d)
tmpdir="$out/debug"
mkdir -p $out
cp -r docs/pandoc/style.css docs $out
mkdir -p $tmpdir
cp -r docs $out
# Generate md docs
cat ${optionsDocNixos.optionsCommonMark} | tail -n +58 >> "$tmpdir"/nixos.md
+43 -20
View File
@@ -18,25 +18,39 @@ in {
];
options.nixarr = {
enable = mkEnableOption ''
Primarily, lets you host the "*Arrs" services optionally through a VPN.
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether or not to enable the nixarr module. Has the following features:
It is possible, _but not recommended_, to have
prowlarr/sonarr/radarr/readarr/lidarr behind a VPN, because it can cause
rate limiting issues. Generally, you should use VPN on transmission
and maybe jellyfin, depending on your setup. Also sets permissions
and creates directories.
- **Run services through a VPN:** You can run any service that this module
supports through a VPN, fx `nixarr.transmission.vpn.enable = true;`
- **Automatic Directories, Users and Permissions:** The module automatically
creates directories and users for your media library. It also sets sane
permissions.
- **State Management:** All services support state management and all state
that they manage is located by default in `/data/.state/nixarr/*`
- **Optional Automatic Port Forwarding:** This module has a UPNP module that
lets services request ports from your router automatically, if you enable it.
It is possible, _but not recommended_, to run the "*Arrs" behind a VPN,
because it can cause rate limiting issues. Generally, you should use
VPN on transmission and maybe jellyfin, depending on your setup.
- Jellyfin
- Lidarr
- Prowlarr
- Radarr
- Readarr
- Sonarr
- Transmission
The following services are supported:
Remember to read the options.
'';
- Jellyfin
- Lidarr
- Prowlarr
- Radarr
- Readarr
- Sonarr
- Transmission
Remember to read the options.
'';
};
mediaDir = mkOption {
type = types.path;
@@ -55,12 +69,21 @@ in {
};
vpn = {
enable = mkEnableOption "Enable vpn";
enable = mkOption {
type = types.bool;
default = false;
description = ''
**Required options:** [`nixarr.vpn.wgConf`](/options.html#nixarr.vpn.wgConf)
Whether or not to enable VPN support for the services that nixarr
supports.
'';
};
wgConf = mkOption {
type = types.nullOr types.path;
default = null;
description = "REQUIRED! The path to the wireguard configuration file.";
description = "The path to the wireguard configuration file.";
};
dnsServers = mkOption {
@@ -75,8 +98,8 @@ in {
vpnTestService = {
enable = mkEnableOption ''
Enable the vpn test service. Useful for testing DNS leaks or VPN
port forwarding.
the vpn test service. Useful for testing DNS leaks or if the VPN
port forwarding works correctly.
'';
port = mkOption {
+38 -29
View File
@@ -10,7 +10,7 @@ with lib; let
dnsServers = config.lib.vpn.dnsServers;
in {
options.nixarr.jellyfin = {
enable = mkEnableOption "Enable the Jellyfin service.";
enable = mkEnableOption "the Jellyfin service.";
stateDir = mkOption {
type = types.path;
@@ -18,27 +18,35 @@ in {
description = "The state directory for Jellyfin.";
};
vpn.enable = mkEnableOption ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
vpn.enable = mkOption {
type = types.bool;
default = false;
description = ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
Route Jellyfin traffic through the VPN.
'';
Route Jellyfin traffic through the VPN.
'';
};
expose = {
vpn = {
enable = mkEnableOption ''
**Required options:**
enable = mkOption {
type = types.bool;
default = false;
description = ''
**Required options:**
- [`nixarr.jellyfin.vpn.enable`](/options.html#nixarr.jellyfin.vpn.enable)
- [`nixarr.jellyfin.expose.vpn.port`](/options.html#nixarr.jellyfin.expose.vpn.port)
- [`nixarr.jellyfin.expose.vpn.accessibleFrom`](/options.html#nixarr.jellyfin.expose.vpn.accessibleFrom)
- [`nixarr.jellyfin.vpn.enable`](/options.html#nixarr.jellyfin.vpn.enable)
- [`nixarr.jellyfin.expose.vpn.port`](/options.html#nixarr.jellyfin.expose.vpn.port)
- [`nixarr.jellyfin.expose.vpn.accessibleFrom`](/options.html#nixarr.jellyfin.expose.vpn.accessibleFrom)
Expose the Jellyfin web service to the internet, allowing anyone to
access it.
Expose the Jellyfin web service to the internet, allowing anyone to
access it.
**Important:** Do _not_ enable this without setting up Jellyfin
authentication through localhost first!
'';
**Important:** Do _not_ enable this without setting up Jellyfin
authentication through localhost first!
'';
};
port = mkOption {
type = with types; nullOr port;
@@ -60,25 +68,26 @@ in {
};
https = {
enable = mkEnableOption ''
**Required options:**
enable = mkOption {
type = types.bool;
default = false;
description = ''
**Required options:**
- [`nixarr.jellyfin.expose.https.acmeMail`](/options.html#nixarr.jellyfin.expose.https.acmeMail)
- [`nixarr.jellyfin.expose.https.domainName`](/options.html#nixarr.jellyfin.expose.https.domainName)
- [`nixarr.jellyfin.expose.https.acmeMail`](/options.html#nixarr.jellyfin.expose.https.acmeMail)
- [`nixarr.jellyfin.expose.https.domainName`](/options.html#nixarr.jellyfin.expose.https.domainName)
**Conflicting options:** [`nixarr.jellyfin.vpn.enable`](/options.html#nixarr.jellyfin.vpn.enable)
**Conflicting options:** [`nixarr.jellyfin.vpn.enable`](/options.html#nixarr.jellyfin.vpn.enable)
Expose the Jellyfin web service to the internet with https support,
allowing anyone to access it.
Expose the Jellyfin web service to the internet with https support,
allowing anyone to access it.
**Important:** Do _not_ enable this without setting up Jellyfin
authentication through localhost first!
'';
**Important:** Do _not_ enable this without setting up Jellyfin
authentication through localhost first!
'';
};
upnp.enable = mkEnableOption ''
Use UPNP to try to open ports 80 and 443 on your router.
'';
upnp.enable = mkEnableOption "UPNP to try to open ports 80 and 443 on your router.";
domainName = mkOption {
type = types.nullOr types.str;
+9 -5
View File
@@ -9,7 +9,7 @@ with lib; let
nixarr = config.nixarr;
in {
options.nixarr.lidarr = {
enable = mkEnableOption "Enable the Lidarr service.";
enable = mkEnableOption "the Lidarr service.";
stateDir = mkOption {
type = types.path;
@@ -17,11 +17,15 @@ in {
description = "The state directory for Lidarr";
};
vpn.enable = mkEnableOption ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
vpn.enable = mkOption {
type = types.bool;
default = false;
description = ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
Route Lidarr traffic through the VPN.
'';
Route Lidarr traffic through the VPN.
'';
};
};
config = mkIf cfg.enable {
+9 -5
View File
@@ -15,7 +15,7 @@ in {
];
options.nixarr.prowlarr = {
enable = mkEnableOption "Enable the Prowlarr service.";
enable = mkEnableOption "the Prowlarr service.";
stateDir = mkOption {
type = types.path;
@@ -23,11 +23,15 @@ in {
description = "The state directory for Prowlarr.";
};
vpn.enable = mkEnableOption ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
vpn.enable = mkOption {
type = types.bool;
default = false;
description = ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
Route Prowlarr traffic through the VPN.
'';
Route Prowlarr traffic through the VPN.
'';
};
};
config = mkIf cfg.enable {
+8 -4
View File
@@ -19,11 +19,15 @@ in {
description = "The state directory for radarr.";
};
vpn.enable = mkEnableOption ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
vpn.enable = mkOption {
type = types.bool;
default = false;
description = ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
Route Radarr traffic through the VPN.
'';
Route Radarr traffic through the VPN.
'';
};
};
config = mkIf cfg.enable {
+8 -4
View File
@@ -17,11 +17,15 @@ in {
description = "The state directory for Readarr";
};
vpn.enable = mkEnableOption ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
vpn.enable = mkOption {
type = types.bool;
default = false;
description = ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
Route Readarr traffic through the VPN.
'';
Route Readarr traffic through the VPN.
'';
};
};
config = mkIf cfg.enable {
+8 -4
View File
@@ -23,11 +23,15 @@ in {
description = "The state directory for Sonarr.";
};
vpn.enable = mkEnableOption ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
vpn.enable = mkOption {
type = types.bool;
default = false;
description = ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
Route Sonarr traffic through the VPN.
'';
Route Sonarr traffic through the VPN.
'';
};
};
config = mkIf cfg.enable {
+23 -15
View File
@@ -11,7 +11,7 @@ with lib; let
dnsServers = config.lib.vpn.dnsServers;
in {
options.nixarr.transmission = {
enable = mkEnableOption "Enable the Transmission service.";
enable = mkEnableOption "the Transmission service.";
stateDir = mkOption {
type = types.path;
@@ -29,23 +29,31 @@ in {
'';
};
vpn.enable = mkEnableOption ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
vpn.enable = mkOption {
type = types.bool;
default = false;
description = ''
**Required options:** [`nixarr.vpn.enable`](/options.html#nixarr.vpn.enable)
**Recommended:** Route Transmission traffic through the VPN.
'';
**Recommended:** Route Transmission traffic through the VPN.
'';
};
flood.enable = mkEnableOption "Use the flood web-UI";
flood.enable = mkEnableOption "the flood web-UI for the transmission web-UI.";
privateTrackers = mkEnableOption ''
Disable pex and dht, which is required for some private trackers.
privateTrackers = mkOption {
type = types.bool;
default = false;
description = ''
Disable pex and dht, which is required for some private trackers.
You don't want to enable this unless a private tracker requires you
to, and some don't. All torrents from private trackers are set as
"private", and this automatically disables dht and pex for that torrent,
so it shouldn't even be a necessary rule to have, but I don't make
their rules ¯\_()_/¯.
'';
You don't want to enable this unless a private tracker requires you
to, and some don't. All torrents from private trackers are set as
"private", and this automatically disables dht and pex for that torrent,
so it shouldn't even be a necessary rule to have, but I don't make
their rules ¯\_()_/¯.
'';
};
messageLevel = mkOption {
type = types.enum [
@@ -58,7 +66,7 @@ in {
"trace"
];
default = "warn";
description = "Sets the message level of transmission";
description = "Sets the message level of transmission.";
};
peerPort = mkOption {