Changed handling of nixarr.enable option dependency

This commit is contained in:
rasmus-kirk
2025-03-18 15:44:27 +01:00
parent 5da89a70c6
commit 2e7d3a901d
15 changed files with 427 additions and 540 deletions
+4
View File
@@ -5,6 +5,10 @@
Added: Added:
- Plex service - Plex service
Updated:
- If `nixarr.enable` is not enabled other services will automatically now
be disabled, instead of throwing an assertion error.
## 2025-03-17 ## 2025-03-17
Added: Added:
+1 -10
View File
@@ -19,8 +19,6 @@ in {
example = true; example = true;
description = '' description = ''
Whether or not to enable the Bazarr service. Whether or not to enable the Bazarr service.
**Required options:** [`nixarr.enable`](#nixarr.enable)
''; '';
}; };
@@ -65,7 +63,7 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = mkIf (nixarr.enable && cfg.enable) {
assertions = [ assertions = [
{ {
assertion = cfg.vpn.enable -> nixarr.vpn.enable; assertion = cfg.vpn.enable -> nixarr.vpn.enable;
@@ -74,13 +72,6 @@ in {
nixarr.vpn.enable option to be set, but it was not. nixarr.vpn.enable option to be set, but it was not.
''; '';
} }
{
assertion = cfg.enable -> nixarr.enable;
message = ''
The nixarr.bazarr.enable option requires the nixarr.enable option
to be set, but it was not.
'';
}
]; ];
util-nixarr.services.bazarr = { util-nixarr.services.bazarr = {
+1 -17
View File
@@ -45,7 +45,6 @@ in {
description = '' description = ''
**Required options:** **Required options:**
- [`nixarr.enable`](#nixarr.enable)
- [`nixarr.ddns.njalla.keysFile`](#nixarr.ddns.njalla.keysfile) - [`nixarr.ddns.njalla.keysFile`](#nixarr.ddns.njalla.keysfile)
- [`nixarr.vpn.enable`](#nixarr.vpn.enable) - [`nixarr.vpn.enable`](#nixarr.vpn.enable)
@@ -75,7 +74,6 @@ in {
description = '' description = ''
**Required options:** **Required options:**
- [`nixarr.enable`](#nixarr.enable)
- [`nixarr.ddns.njalla.keysFile`](#nixarr.ddns.njalla.keysfile) - [`nixarr.ddns.njalla.keysFile`](#nixarr.ddns.njalla.keysfile)
Whether or not to enable DDNS for a [Njalla](https://njal.la/) Whether or not to enable DDNS for a [Njalla](https://njal.la/)
@@ -111,7 +109,7 @@ in {
}; };
}; };
config = mkIf cfg.njalla.enable { config = mkIf (nixarr.enable && cfg.enable) {
assertions = [ assertions = [
{ {
assertion = cfg.njalla.enable -> cfg.njalla.keysFile != null; assertion = cfg.njalla.enable -> cfg.njalla.keysFile != null;
@@ -120,20 +118,6 @@ in {
nixarr.ddns.njalla.keysFile option to be set, but it was not. nixarr.ddns.njalla.keysFile option to be set, but it was not.
''; '';
} }
{
assertion = cfg.njalla.enable -> nixarr.enable;
message = ''
The nixarr.ddns.njalla.enable option requires the nixarr.enable
option to be set, but it was not.
'';
}
{
assertion = cfg.njalla.vpn.enable -> nixarr.enable;
message = ''
The nixarr.ddns.njalla.vpn.enable option requires the nixarr.enable
option to be set, but it was not.
'';
}
{ {
assertion = cfg.njalla.vpn.enable -> cfg.njalla.vpn.keysFile != null; assertion = cfg.njalla.vpn.enable -> cfg.njalla.vpn.keysFile != null;
message = '' message = ''
+4 -15
View File
@@ -3,12 +3,12 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
with lib; let
cfg = config.nixarr.jellyfin; cfg = config.nixarr.jellyfin;
defaultPort = 8096; defaultPort = 8096;
nixarr = config.nixarr; nixarr = config.nixarr;
in in {
with lib; {
options.nixarr.jellyfin = { options.nixarr.jellyfin = {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
@@ -16,8 +16,6 @@ in
example = true; example = true;
description = '' description = ''
Whether or not to enable the Jellyfin service. Whether or not to enable the Jellyfin service.
**Required options:** [`nixarr.enable`](#nixarr.enable)
''; '';
}; };
@@ -104,9 +102,7 @@ in
}; };
}; };
config = config = mkIf (nixarr.enable && cfg.enable) {
mkIf cfg.enable
{
assertions = [ assertions = [
{ {
assertion = cfg.vpn.enable -> nixarr.vpn.enable; assertion = cfg.vpn.enable -> nixarr.vpn.enable;
@@ -115,13 +111,6 @@ in
nixarr.vpn.enable option to be set, but it was not. nixarr.vpn.enable option to be set, but it was not.
''; '';
} }
{
assertion = cfg.enable -> nixarr.enable;
message = ''
The nixarr.jellyfin.enable option requires the nixarr.enable
option to be set, but it was not.
'';
}
{ {
assertion = !(cfg.vpn.enable && cfg.expose.https.enable); assertion = !(cfg.vpn.enable && cfg.expose.https.enable);
message = '' message = ''
+1 -10
View File
@@ -20,8 +20,6 @@ in {
example = true; example = true;
description = '' description = ''
Whether or not to enable the Jellyseerr service. Whether or not to enable the Jellyseerr service.
**Required options:** [`nixarr.enable`](#nixarr.enable)
''; '';
}; };
@@ -73,15 +71,8 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = mkIf (nixarr.enable && cfg.enable) {
assertions = [ assertions = [
{
assertion = cfg.enable -> nixarr.enable;
message = ''
The nixarr.jellyseerr.enable option requires the
nixarr.enable option to be set, but it was not.
'';
}
{ {
assertion = cfg.vpn.enable -> nixarr.vpn.enable; assertion = cfg.vpn.enable -> nixarr.vpn.enable;
message = '' message = ''
+1 -10
View File
@@ -16,8 +16,6 @@ in {
example = true; example = true;
description = '' description = ''
Whether or not to enable the Lidarr service. Whether or not to enable the Lidarr service.
**Required options:** [`nixarr.enable`](#nixarr.enable)
''; '';
}; };
@@ -62,15 +60,8 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = mkIf (nixarr.enable && cfg.enable) {
assertions = [ assertions = [
{
assertion = cfg.enable -> nixarr.enable;
message = ''
The nixarr.lidarr.enable option requires the nixarr.enable option
to be set, but it was not.
'';
}
{ {
assertion = cfg.vpn.enable -> nixarr.vpn.enable; assertion = cfg.vpn.enable -> nixarr.vpn.enable;
message = '' message = ''
+1 -9
View File
@@ -14,7 +14,6 @@ in {
description = '' description = ''
**Required options:** **Required options:**
- [`nixarr.vpn.enable`](#nixarr.vpn.enable) - [`nixarr.vpn.enable`](#nixarr.vpn.enable)
- [`nixarr.enable`](#nixarr.enable)
Run the openssh service through a vpn, exposing it to the internet. Run the openssh service through a vpn, exposing it to the internet.
@@ -44,15 +43,8 @@ in {
''; '';
}; };
config = mkIf cfg.expose.vpn.enable { config = mkIf (cfg.expose.vpn.enable && cfg.enable) {
assertions = [ assertions = [
{
assertion = cfg.expose.vpn.enable -> nixarr.enable;
message = ''
The nixarr.openssh.expose.vpn.enable option requires the
nixarr.enable option to be set, but it was not.
'';
}
{ {
assertion = cfg.expose.vpn.enable -> nixarr.vpn.enable; assertion = cfg.expose.vpn.enable -> nixarr.vpn.enable;
message = '' message = ''
+4 -15
View File
@@ -3,12 +3,12 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
with lib; let
cfg = config.nixarr.plex; cfg = config.nixarr.plex;
defaultPort = 32400; defaultPort = 32400;
nixarr = config.nixarr; nixarr = config.nixarr;
in in {
with lib; {
options.nixarr.plex = { options.nixarr.plex = {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
@@ -16,8 +16,6 @@ in
example = true; example = true;
description = '' description = ''
Whether or not to enable the Plex service. Whether or not to enable the Plex service.
**Required options:** [`nixarr.enable`](#nixarr.enable)
''; '';
}; };
@@ -104,9 +102,7 @@ in
}; };
}; };
config = config = mkIf (nixarr.enable && cfg.enable) {
mkIf cfg.enable
{
assertions = [ assertions = [
{ {
assertion = cfg.vpn.enable -> nixarr.vpn.enable; assertion = cfg.vpn.enable -> nixarr.vpn.enable;
@@ -115,13 +111,6 @@ in
nixarr.vpn.enable option to be set, but it was not. nixarr.vpn.enable option to be set, but it was not.
''; '';
} }
{
assertion = cfg.enable -> nixarr.enable;
message = ''
The nixarr.plex.enable option requires the nixarr.enable
option to be set, but it was not.
'';
}
{ {
assertion = !(cfg.vpn.enable && cfg.expose.https.enable); assertion = !(cfg.vpn.enable && cfg.expose.https.enable);
message = '' message = ''
+1 -10
View File
@@ -20,8 +20,6 @@ in {
example = true; example = true;
description = '' description = ''
Whether or not to enable the Prowlarr service. Whether or not to enable the Prowlarr service.
**Required options:** [`nixarr.enable`](#nixarr.enable)
''; '';
}; };
@@ -66,15 +64,8 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = mkIf (nixarr.enable && cfg.enable) {
assertions = [ assertions = [
{
assertion = cfg.enable -> nixarr.enable;
message = ''
The nixarr.prowlarr.enable option requires the
nixarr.enable option to be set, but it was not.
'';
}
{ {
assertion = cfg.vpn.enable -> nixarr.vpn.enable; assertion = cfg.vpn.enable -> nixarr.vpn.enable;
message = '' message = ''
+1 -10
View File
@@ -16,8 +16,6 @@ in {
example = true; example = true;
description = '' description = ''
Whether or not to enable the Radarr service. Whether or not to enable the Radarr service.
**Required options:** [`nixarr.enable`](#nixarr.enable)
''; '';
}; };
@@ -62,15 +60,8 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = mkIf (nixarr.enable && cfg.enable) {
assertions = [ assertions = [
{
assertion = cfg.enable -> nixarr.enable;
message = ''
The nixarr.radarr.enable option requires the
nixarr.enable option to be set, but it was not.
'';
}
{ {
assertion = cfg.vpn.enable -> nixarr.vpn.enable; assertion = cfg.vpn.enable -> nixarr.vpn.enable;
message = '' message = ''
+1 -10
View File
@@ -16,8 +16,6 @@ in {
example = true; example = true;
description = '' description = ''
Whether or not to enable the Readarr service. Whether or not to enable the Readarr service.
**Required options:** [`nixarr.enable`](#nixarr.enable)
''; '';
}; };
@@ -62,15 +60,8 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = mkIf (nixarr.enable && cfg.enable) {
assertions = [ assertions = [
{
assertion = cfg.enable -> nixarr.enable;
message = ''
The nixarr.readarr.enable option requires the
nixarr.enable option to be set, but it was not.
'';
}
{ {
assertion = cfg.vpn.enable -> nixarr.vpn.enable; assertion = cfg.vpn.enable -> nixarr.vpn.enable;
message = '' message = ''
+1 -10
View File
@@ -59,8 +59,6 @@ in {
example = true; example = true;
description = '' description = ''
Whether or not to enable the Recyclarr service. This service does not need to be run behind a VPN. Whether or not to enable the Recyclarr service. This service does not need to be run behind a VPN.
**Required options:** [`nixarr.enable`](#nixarr.enable)
''; '';
}; };
@@ -164,15 +162,8 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = mkIf (nixarr.enable && cfg.enable) {
assertions = [ assertions = [
{
assertion = cfg.enable -> nixarr.enable;
message = ''
The nixarr.recyclarr.enable option requires the nixarr.enable
option to be set, but it was not.
'';
}
{ {
assertion = cfg.enable -> (nixarr.radarr.enable || nixarr.sonarr.enable); assertion = cfg.enable -> (nixarr.radarr.enable || nixarr.sonarr.enable);
message = '' message = ''
+11 -1
View File
@@ -173,7 +173,17 @@ in {
sab_config_map.write() sab_config_map.write()
''; '';
in in
mkIf cfg.enable { mkIf (nixarr.enable && cfg.enable) {
assertions = [
{
assertion = cfg.vpn.enable -> nixarr.vpn.enable;
message = ''
The nixarr.readarr.vpn.enable option requires the
nixarr.vpn.enable option to be set, but it was not.
'';
}
];
users = { users = {
groups.usenet = {}; groups.usenet = {};
users.usenet = { users.usenet = {
+1 -10
View File
@@ -16,8 +16,6 @@ in {
example = true; example = true;
description = '' description = ''
Whether or not to enable the Sonarr service. Whether or not to enable the Sonarr service.
**Required options:** [`nixarr.enable`](#nixarr.enable)
''; '';
}; };
@@ -62,15 +60,8 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = mkIf (nixarr.enable && cfg.enable) {
assertions = [ assertions = [
{
assertion = cfg.enable -> nixarr.enable;
message = ''
The nixarr.sonarr.enable option requires the
nixarr.enable option to be set, but it was not.
'';
}
{ {
assertion = cfg.vpn.enable -> nixarr.vpn.enable; assertion = cfg.vpn.enable -> nixarr.vpn.enable;
message = '' message = ''
+1 -10
View File
@@ -71,8 +71,6 @@ in {
example = true; example = true;
description = '' description = ''
Whether or not to enable the Transmission service. Whether or not to enable the Transmission service.
**Required options:** [`nixarr.enable`](#nixarr.enable)
''; '';
}; };
@@ -267,7 +265,7 @@ in {
./cross-seed ./cross-seed
]; ];
config = mkIf cfg.enable { config = mkIf (nixarr.enable && cfg.enable) {
assertions = [ assertions = [
{ {
assertion = cfg.vpn.enable -> nixarr.vpn.enable; assertion = cfg.vpn.enable -> nixarr.vpn.enable;
@@ -276,13 +274,6 @@ in {
nixarr.vpn.enable option to be set, but it was not. nixarr.vpn.enable option to be set, but it was not.
''; '';
} }
{
assertion = cfg.enable -> nixarr.enable;
message = ''
The nixarr.transmission.enable option requires the nixarr.enable
option to be set, but it was not.
'';
}
{ {
assertion = cfg-cross-seed.enable -> nixarr.prowlarr.enable; assertion = cfg-cross-seed.enable -> nixarr.prowlarr.enable;
message = '' message = ''