{ pkgs, config, lib, osConfig, ... }: let cfg = config.my.mpd; in { options.my.mpd = { enable = lib.mkEnableOption null; usePipewire = lib.mkEnableOption null // { default = true; }; ncmpcpp = { enable = lib.mkEnableOption null; }; }; config = lib.mkIf cfg.enable { services.mpd = { enable = true; extraConfig = '' restore_paused "yes" zeroconf_enabled "no" ${lib.optionalString cfg.usePipewire '' audio_output { type "pipewire" name "Pipewire Sound Server" mixer_type "hardware" replay_gain_handler "none" } ''} ''; }; home.packages = [ pkgs.mpc-cli ]; programs.ncmpcpp = lib.mkIf cfg.ncmpcpp.enable { enable = true; settings = { mpd_host = "127.0.0.1"; mpd_port = config.services.mpd.network.port; }; }; }; }