nixos/mpd: correctly handle null valued cfg.settings

Tested with:

```diff
diff --git a/nixos/tests/mpd.nix b/nixos/tests/mpd.nix
index 36337bfbb4de..980dcca9048d 100644
--- a/nixos/tests/mpd.nix
+++ b/nixos/tests/mpd.nix
@@ -63,6 +63,7 @@ in
           mpd = defaultMpdCfg // {
             settings = {
               bind_to_address = "any";
+              db_file = null;
               audio_output = [
                 {
                   type = "alsa";
```

Per https://github.com/NixOS/nixpkgs/pull/485884#issuecomment-3865647552
This commit is contained in:
Doron Behar
2026-02-08 00:49:14 +02:00
parent f5fb7f6782
commit e1b4daab36
+3 -4
View File
@@ -26,10 +26,9 @@ let
"\"" + (toString v) + "\""
)
) a;
nonBlockSettings = lib.filterAttrs (
n: v: !(builtins.isAttrs v || builtins.isList v || isNull v)
) cfg.settings;
pureBlockSettings = removeAttrs cfg.settings (builtins.attrNames nonBlockSettings);
settings = lib.filterAttrs (n: v: !(isNull v)) cfg.settings;
nonBlockSettings = lib.filterAttrs (n: v: !(builtins.isAttrs v || builtins.isList v)) settings;
pureBlockSettings = removeAttrs settings (builtins.attrNames nonBlockSettings);
blocks =
pureBlockSettings
// lib.optionalAttrs cfg.fluidsynth {