1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 12:11:28 +00:00

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.
This commit is contained in:
Martin Weinelt 2024-02-05 14:41:25 +01:00
parent 143d266f0d
commit 91d9c159da
No known key found for this signature in database
GPG key ID: 87C1E9888F856759

View file

@ -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";