From e1b4daab36650f1ffa9583a4df8be4002aa9fab0 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 8 Feb 2026 00:49:14 +0200 Subject: [PATCH] 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 --- nixos/modules/services/audio/mpd.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix index 1801bdc989d8..bc5c206f967b 100644 --- a/nixos/modules/services/audio/mpd.nix +++ b/nixos/modules/services/audio/mpd.nix @@ -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 {