Added assertions
This commit is contained in:
@@ -12,7 +12,16 @@ in {
|
||||
];
|
||||
|
||||
options.nixarr.bazarr = {
|
||||
enable = mkEnableOption "the bazarr service.";
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Whether or not to enable the Bazarr service.
|
||||
|
||||
**Required options:** [`nixarr.enable`](#nixarr.enable)
|
||||
'';
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
type = types.path;
|
||||
@@ -62,6 +71,13 @@ in {
|
||||
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 = {
|
||||
|
||||
+27
-9
@@ -6,6 +6,7 @@
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.nixarr.ddns;
|
||||
nixarr = config.nixarr;
|
||||
ddns-njalla = pkgs.writeShellApplication {
|
||||
name = "ddns-njalla";
|
||||
|
||||
@@ -44,6 +45,7 @@ in {
|
||||
description = ''
|
||||
**Required options:**
|
||||
|
||||
- [`nixarr.enable`](#nixarr.enable)
|
||||
- [`nixarr.ddns.njalla.keysFile`](#nixarr.ddns.njalla.keysfile)
|
||||
- [`nixarr.vpn.enable`](#nixarr.vpn.enable)
|
||||
|
||||
@@ -73,6 +75,7 @@ in {
|
||||
description = ''
|
||||
**Required options:**
|
||||
|
||||
- [`nixarr.enable`](#nixarr.enable)
|
||||
- [`nixarr.ddns.njalla.keysFile`](#nixarr.ddns.njalla.keysfile)
|
||||
|
||||
Whether or not to enable DDNS for a [Njalla](https://njal.la/)
|
||||
@@ -118,16 +121,31 @@ in {
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
cfg.njalla.vpn.enable
|
||||
-> (
|
||||
cfg.njalla.vpn.keysFile
|
||||
!= null
|
||||
&& config.nixarr.vpn.enable
|
||||
);
|
||||
assertion = cfg.njalla.enable -> nixarr.enable;
|
||||
message = ''
|
||||
The nixarr.ddns.njalla.enable option requires the
|
||||
nixarr.vpn.enable option to be set, but it was not.
|
||||
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;
|
||||
message = ''
|
||||
The nixarr.ddns.njalla.enable option requires the nixarr.vpn.keysFile
|
||||
option to be set (not null), but it was not.
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion = cfg.njalla.vpn.enable -> config.nixarr.vpn.enable;
|
||||
message = ''
|
||||
The nixarr.ddns.njalla.enable option requires the nixarr.vpn.enable
|
||||
option to be set, but it was not.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
@@ -9,7 +9,16 @@
|
||||
in
|
||||
with lib; {
|
||||
options.nixarr.jellyfin = {
|
||||
enable = mkEnableOption "the Jellyfin service.";
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Whether or not to enable the Jellyfin service.
|
||||
|
||||
**Required options:** [`nixarr.enable`](#nixarr.enable)
|
||||
'';
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
type = types.path;
|
||||
@@ -143,6 +152,13 @@ in
|
||||
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);
|
||||
message = ''
|
||||
|
||||
@@ -9,7 +9,16 @@ with lib; let
|
||||
defaultPort = 8686;
|
||||
in {
|
||||
options.nixarr.lidarr = {
|
||||
enable = mkEnableOption "the Lidarr service.";
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Whether or not to enable the Lidarr service.
|
||||
|
||||
**Required options:** [`nixarr.enable`](#nixarr.enable)
|
||||
'';
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
type = types.path;
|
||||
@@ -52,6 +61,13 @@ in {
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
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;
|
||||
message = ''
|
||||
|
||||
@@ -12,7 +12,9 @@ in {
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
**Required options:** [`nixarr.vpn.enable`](#nixarr.vpn.enable)
|
||||
**Required options:**
|
||||
- [`nixarr.vpn.enable`](#nixarr.vpn.enable)
|
||||
- [`nixarr.enable`](#nixarr.enable)
|
||||
|
||||
Run the openssh service through a vpn, exposing it to the internet.
|
||||
|
||||
@@ -44,6 +46,13 @@ in {
|
||||
|
||||
config = mkIf cfg.expose.vpn.enable {
|
||||
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;
|
||||
message = ''
|
||||
|
||||
@@ -14,7 +14,16 @@ in {
|
||||
];
|
||||
|
||||
options.nixarr.prowlarr = {
|
||||
enable = mkEnableOption "the Prowlarr service.";
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Whether or not to enable the Prowlarr service.
|
||||
|
||||
**Required options:** [`nixarr.enable`](#nixarr.enable)
|
||||
'';
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
type = types.path;
|
||||
@@ -57,6 +66,13 @@ in {
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
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;
|
||||
message = ''
|
||||
|
||||
@@ -10,7 +10,16 @@ with lib; let
|
||||
nixarr = config.nixarr;
|
||||
in {
|
||||
options.nixarr.radarr = {
|
||||
enable = mkEnableOption "Enable the Radarr service.";
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Whether or not to enable the Radarr service.
|
||||
|
||||
**Required options:** [`nixarr.enable`](#nixarr.enable)
|
||||
'';
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
type = types.path;
|
||||
@@ -53,6 +62,13 @@ in {
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
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;
|
||||
message = ''
|
||||
|
||||
@@ -8,7 +8,16 @@ with lib; let
|
||||
nixarr = config.nixarr;
|
||||
in {
|
||||
options.nixarr.readarr = {
|
||||
enable = mkEnableOption "Enable the Readarr service";
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Whether or not to enable the Readarr service.
|
||||
|
||||
**Required options:** [`nixarr.enable`](#nixarr.enable)
|
||||
'';
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
type = types.path;
|
||||
@@ -51,6 +60,13 @@ in {
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
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;
|
||||
message = ''
|
||||
|
||||
@@ -13,7 +13,12 @@ in {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable the Sonarr service.";
|
||||
example = true;
|
||||
description = ''
|
||||
Whether or not to enable the Sonarr service.
|
||||
|
||||
**Required options:** [`nixarr.enable`](#nixarr.enable)
|
||||
'';
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
@@ -57,6 +62,13 @@ in {
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
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;
|
||||
message = ''
|
||||
|
||||
@@ -16,7 +16,7 @@ with lib; let
|
||||
runtimeInputs = with pkgs; [curl];
|
||||
|
||||
text = ''
|
||||
PROWLARR_API_KEY=$(cat prowlarr-api-key)
|
||||
PROWLARR_API_KEY=$(cat ${cfg.stateDir}/prowlarr-api-key)
|
||||
curl -XPOST http://localhost:2468/api/webhook?apikey="$PROWLARR_API_KEY" --data-urlencode "infoHash=$TR_TORRENT_HASH"
|
||||
'';
|
||||
};
|
||||
@@ -65,7 +65,16 @@ with lib; let
|
||||
};
|
||||
in {
|
||||
options.nixarr.transmission = {
|
||||
enable = mkEnableOption "the Transmission service.";
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Whether or not to enable the Transmission service.
|
||||
|
||||
**Required options:** [`nixarr.enable`](#nixarr.enable)
|
||||
'';
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
type = types.path;
|
||||
@@ -254,6 +263,13 @@ in {
|
||||
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;
|
||||
message = ''
|
||||
|
||||
Reference in New Issue
Block a user