snowflake/user/music.nix
2025-05-30 22:59:38 +08:00

102 lines
3.2 KiB
Nix

{ config, lib, ... }:
let
inherit (lib) mkIf mkOption types;
cfg = config.music;
in
{
options.music = {
enable = mkOption {
default = false;
type = types.bool;
description = ''Enables MPD server'';
};
directory = mkOption {
default = "~/Music";
type = types.str;
description = ''Path to your music directory'';
};
ncmpcpp.enable = mkOption {
default = false;
type = types.bool;
description = ''Enables NCMPCPP (MPD Client)'';
};
rmpc.enable = mkOption {
default = false;
type = types.bool;
description = ''
Enables RMPC (Rusty Music Player Client) (another MPD Client)
'';
};
};
config = {
services.mpd = {
enable = cfg.enable;
musicDirectory = cfg.directory;
extraConfig = builtins.readFile ../config/mpd.conf;
};
programs = mkIf cfg.enable {
ncmpcpp = {
enable = cfg.ncmpcpp.enable;
bindings = [
{ key = "k"; command = "scroll_up"; }
{ key = "j"; command = "scroll_down"; }
{ key = "l"; command = "next_column"; }
{ key = "l"; command = "slave_screen"; }
{ key = "h"; command = "previous_column"; }
{ key = "h"; command = "master_screen"; }
{ key = "G"; command = "move_end"; }
{ key = "g"; command = "move_home"; }
{ key = "alt-l"; command = "show_lyrics"; }
];
settings = {
ncmpcpp_directory = "~/.config/ncmpcpp";
system_encoding = "utf-8";
visualizer_output_name = "my_fifo";
visualizer_type = "ellipse";
visualizer_in_stereo = "yes";
visualizer_look = "";
visualizer_color = "blue, cyan, green, yellow, magenta, red, black";
playlist_display_mode = "columns";
media_library_primary_tag = "album_artist";
media_library_hide_album_dates = true;
playlist_shorten_total_times = "yes";
playlist_editor_display_mode = "columns";
lyrics_fetchers = "genius, internet";
browser_display_mode = "columns";
search_engine_display_mode = "columns";
autocenter_mode = "yes";
mouse_support = "yes";
centered_cursor = "yes";
follow_now_playing_lyrics = "yes";
display_bitrate = "no";
external_editor = "vim";
progressbar_elapsed_color = "white";
progressbar_color = "black";
user_interface = "alternative";
header_visibility = "no";
statusbar_visibility = "yes";
titles_visibility = "yes";
progressbar_look = "";
statusbar_color = "white";
enable_window_title = "yes";
now_playing_prefix = "$b$1";
now_playing_suffix = "$8$/b";
song_list_format = "$1 $2%A$8 - $8%t $R $3%l ";
song_status_format = "$b$7 $2%a $8- $3%b $8- $8%t ";
song_window_title_format = " {%A} - {%t}";
song_columns_list_format = "(23)[white]{a} (26)[yellow]{t|f} (40)[green]{b} (4)[blue]{l}";
startup_slave_screen = "playlist";
startup_slave_screen_focus = "yes";
locked_screen_width_part = "50";
};
};
rmpc.enable = cfg.rmpc.enable;
};
};
}