diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2024-02-05 14:41:25 +0100 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2024-02-09 16:05:05 +0100 |
commit | 91d9c159da33cee81db80eca5643493ce2c65522 (patch) | |
tree | db3a123ad52112526a691300a04df53b09155d2a /nixos | |
parent | 143d266f0db386af987d19e0de79128bc8669714 (diff) |
nixos/matrix-synapse: fix recursive filtering of null values
Using `filterAttrsRecursive` is not sufficient to account for a nested attribute set with list values, like used for listeners.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/matrix/synapse.nix | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nixos/modules/services/matrix/synapse.nix b/nixos/modules/services/matrix/synapse.nix index a6304d3533871..e3f9c7742cc7d 100644 --- a/nixos/modules/services/matrix/synapse.nix +++ b/nixos/modules/services/matrix/synapse.nix @@ -6,8 +6,16 @@ let cfg = config.services.matrix-synapse; format = pkgs.formats.yaml { }; + filterRecursiveNull = o: + if isAttrs o then + mapAttrs (_: v: filterRecursiveNull v) (filterAttrs (_: v: v != null) o) + else if isList o then + map filterRecursiveNull (filter (v: v != null) o) + else + o; + # remove null values from the final configuration - finalSettings = lib.filterAttrsRecursive (_: v: v != null) cfg.settings; + finalSettings = filterRecursiveNull cfg.settings; configFile = format.generate "homeserver.yaml" finalSettings; usePostgresql = cfg.settings.database.name == "psycopg2"; |