From bb8f338c683cadd8d8cd6483788fa0bcb23dca59 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Wed, 20 Nov 2024 02:23:49 -0500 Subject: [PATCH] feat: add assertion to ensure correctness of options --- modules/forgejo/options.nix | 7 +++++++ modules/options.nix | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/forgejo/options.nix b/modules/forgejo/options.nix index 9b392af..b48a84d 100644 --- a/modules/forgejo/options.nix +++ b/modules/forgejo/options.nix @@ -42,4 +42,11 @@ args@{ config, lib, ... }: }; }; }; + + config.assertions = lib.mkIf config.aether.https [ + { + assertion = !(builtins.isNull config.aether.acmeEmail); + message = "HTTPS support requires providing a contact email"; + } + ]; } diff --git a/modules/options.nix b/modules/options.nix index 944814d..5d606d0 100644 --- a/modules/options.nix +++ b/modules/options.nix @@ -12,8 +12,8 @@ }; acmeEmail = lib.mkOption { - type = lib.types.str; - default = ""; + type = lib.types.nullOr lib.types.str; + default = null; description = "Email address for ACME."; }; }