From 09119803e8731b123313641bbfc5a81d16b78f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=E2=80=9CNiols=E2=80=9D=20Jeannerod?= Date: Tue, 3 Jun 2025 08:18:30 +0200 Subject: [PATCH] Deployment: handle nullable config fields This is quite frustrating. In the meantime, it does get the deployment working again. --- deployment/default.nix | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/deployment/default.nix b/deployment/default.nix index ad98f15a..3f8e550a 100644 --- a/deployment/default.nix +++ b/deployment/default.nix @@ -33,11 +33,25 @@ ## information coming from the FediPanel. ## ## FIXME: lock step the interface with the definitions in the FediPanel -panelConfig: +panelConfigNullable: let inherit (lib) mkIf; + nonNull = x: v: if x == null then v else x; + + panelConfig = { + domain = nonNull panelConfigNullable.domain "fediversity.net"; + initialUser = nonNull panelConfigNullable.initialUser { + displayName = "Testy McTestface"; + username = "test"; + password = "testtest"; + email = "test@test.com"; + }; + mastodon = nonNull panelConfigNullable.mastodon { enable = false; }; + peertube = nonNull panelConfigNullable.peertube { enable = false; }; + pixelfed = nonNull panelConfigNullable.pixelfed { enable = false; }; + }; in ## Regular arguments of a NixOps4 deployment module. @@ -122,7 +136,7 @@ in { pkgs, ... }: mkIf (cfg.mastodon.enable || cfg.peertube.enable || cfg.pixelfed.enable) { fediversity = { - inherit (panelConfig) domain; + inherit (cfg) domain; garage.enable = true; pixelfed = pixelfedS3KeyConfig { inherit pkgs; }; mastodon = mastodonS3KeyConfig { inherit pkgs; };