From a466f1462734692cd484f184a978187f250eabdc Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 22 Oct 2024 12:27:24 +0300 Subject: [PATCH] nixos/wakapi: fix incorrect assertion conditions Using implication here (->) causes the assertions to fail haphazardly due to the ordering *implied* by the operator. By using AND, we avoid this case. Unsurprisingly, this was caught by the NixOS test. --- nixos/modules/services/web-apps/wakapi.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/web-apps/wakapi.nix b/nixos/modules/services/web-apps/wakapi.nix index de6ffaac54cf..982b572fb2fa 100644 --- a/nixos/modules/services/web-apps/wakapi.nix +++ b/nixos/modules/services/web-apps/wakapi.nix @@ -182,11 +182,11 @@ in message = "Either `services.wakapi.passwordSalt` or `services.wakapi.passwordSaltFile` must be set."; } { - assertion = cfg.passwordSalt != null -> cfg.passwordSaltFile != null; + assertion = !(cfg.passwordSalt != null && cfg.passwordSaltFile != null); message = "Both `services.wakapi.passwordSalt` `services.wakapi.passwordSaltFile` should not be set at the same time."; } { - assertion = cfg.smtpPassword != null -> cfg.smtpPasswordFile != null; + assertion = !(cfg.smtpPassword != null && cfg.smtpPasswordFile != null); message = "Both `services.wakapi.smtpPassword` `services.wakapi.smtpPasswordFile` should not be set at the same time."; } {