Commit e1b4daab authored by Doron Behar's avatar Doron Behar
Browse files

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
parent f5fb7f67
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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 {