mpd: fix incorrect use of mkIf (#8504)

Currently, if cfg.network.listenAddress is set to "any", MPD_HOST causes
partial evaluation which fails the sanity check while trying to build a
home-manager generation. Hence make a separate attrset for MPD_HOST
which will be evaluated conditionally and then concatenated.

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
Amneesh
2026-01-08 11:21:16 +05:30
committed by GitHub
parent 86e0f6f227
commit a630bbdedd

View File

@@ -166,10 +166,14 @@ in
mkIf cfg.enable {
home = {
packages = [ cfg.package ];
sessionVariables = mkIf cfg.enableSessionVariables {
MPD_HOST = mkIf (cfg.network.listenAddress != "any") cfg.network.listenAddress;
MPD_PORT = builtins.toString cfg.network.port;
};
sessionVariables = mkIf cfg.enableSessionVariables (
{
MPD_PORT = builtins.toString cfg.network.port;
}
// lib.optionalAttrs (cfg.network.listenAddress != "any") {
MPD_HOST = cfg.network.listenAddress;
}
);
};
services.mpd = lib.mkMerge [