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:
parent
143d266f0d
commit
91d9c159da
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue