nix/lib/modules/mpd.nix

32 lines
852 B
Nix

{ user }: { lib, pkgs, config, ... }:
with lib;
let
cfg = config.roles.mpd;
in
{
options.roles.mpd = {
enable = mkEnableOption "setup mpd client";
host = mkOption {default = "music.local";};
};
config = mkIf cfg.enable {
home-manager.users.${user}.imports = [{
programs.ncmpcpp = {
enable = true;
settings.mpd_host = cfg.host;
bindings = [
{ key = "j"; command = "scroll_down"; }
{ key = "k"; command = "scroll_up"; }
{ key = "l"; command = "next_column"; }
{ key = "h"; command = "previous_column"; }
{ key = "J"; command = [ "select_item" "scroll_down" ]; }
{ key = "K"; command = [ "select_item" "scroll_up" ]; }
];
};
services.mpd-mpris = {
enable = true;
mpd.host = cfg.host;
};
}];
};
}