From a0be1f92584a4d3904e754f9dbd284554bd98381 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Tue, 15 Jun 2021 18:10:30 +0200 Subject: music: init --- usecases/desktop/music.nix | 149 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 usecases/desktop/music.nix (limited to 'usecases') diff --git a/usecases/desktop/music.nix b/usecases/desktop/music.nix new file mode 100644 index 0000000..d21f0eb --- /dev/null +++ b/usecases/desktop/music.nix @@ -0,0 +1,149 @@ +inputs: + +{ config, pkgs, ... }: + +{ + assertions = [ + { + assertion = + config.home-manager.users.minijackson.programs.beets.settings ? acoustid && + config.home-manager.users.minijackson.programs.beets.settings.acoustid ? apikey && + config.home-manager.users.minijackson.programs.beets.settings.acoustid.apikey != null; + message = "Please provide the API key for the Acoustid database"; + } + ]; + + services.mpd = { + enable = true; + musicDirectory = "/home/minijackson/Music"; + user = "minijackson"; + group = "users"; + + extraConfig = '' + audio_output { + type "pulse" + name "PulseAudio" + server "127.0.0.1" + } + + audio_output { + type "fifo" + name "Fifo" + path "/tmp/mpd.fifo" + format "44100:16:2" + } + ''; + + startWhenNeeded = true; + }; + + home-manager.users.minijackson = { ... }: + { + programs.beets = { + enable = true; + + package = pkgs.beets.override { + # Python SoCo failed to build + enableSonosUpdate = false; + }; + + settings = { + plugins = [ + "absubmit" + "acousticbrainz" + "badfiles" + "chroma" + "convert" + "edit" + "export" + "fetchart" + "fromfilename" + "lastgenre" + "mbsubmit" + "mbsync" + "missing" + "mpdupdate" + "random" + "the" + "zero" + ]; + lastgenre = { + canonical = true; + # High count due to canonicalization which removes fetched genres + count = 6; + }; + paths = { + default = "%the{$albumartist}/%the{$album}%aunique{}/$track $title"; + singleton = "Non-Album/%the{$artist}/%the{$title}"; + comp = "Compilations/%the{$album}%aunique{}/$track $title"; + }; + zero.fields = "comments"; + }; + }; + + programs.ncmpcpp = { + enable = true; + package = pkgs.ncmpcpp.override { + outputsSupport = true; + visualizerSupport = true; + }; + mpdMusicDir = "/home/minijackson/Music"; + settings = { + visualizer_data_source = "/tmp/mpd.fifo"; + visualizer_output_name = "FIFO"; + visualizer_in_stereo = true; + visualizer_type = "ellipse"; + visualizer_look = "▒▒"; + visualizer_color = "cyan, blue, magenta, red, yellow, green"; + + user_interface = "alternative"; + + media_library_primary_tag = "album_artist"; + + display_bitrate = true; + + #---------------------------------------------------- + # file: ~/.ncmpcpp/config + # author: jason ryan - http://jasonwryan.com/ + #---------------------------------------------------- + + mpd_connection_timeout = "5"; + playlist_disable_highlight_delay = "3"; + message_delay_time = "4"; + header_visibility = true; + statusbar_visibility = true; + song_list_format = "{%a - }{%t}|{$5%f$9}$R{$7(%l)$9}"; + song_status_format = "$2%a $1• $3%t $1• $4%b {(Disc %d) }$1• $5%y$1"; + song_window_title_format = "Ncmpcpp: {%a - }{%t}|{%f}"; + song_columns_list_format = "(7f)[white]{n} (33)[cyan]{t} (20)[green]{a} (20)[magenta]{b} (10)[magenta]{y} (7f)[white]{l}"; + playlist_display_mode = "columns"; + browser_display_mode = "columns"; + titles_visibility = true; + progressbar_look = "─╼·"; + # media_library_left_column = "a" (possible values: a,y,g,c,p, legend above) + header_text_scrolling = true; + # fancy_scrolling = true; + display_remaining_time = true; + ignore_leading_the = true; + empty_tag_marker = ""; + enable_window_title = true; + colors_enabled = true; + header_window_color = "magenta"; + volume_color = "green"; + state_line_color = "yellow"; + state_flags_color = "blue"; + main_window_color = "cyan"; + color1 = "cyan"; + color2 = "blue"; + + current_item_prefix = "$(cyan)$r"; + current_item_suffix = "$/r$(end)"; + + progressbar_color = "yellow"; + statusbar_color = "cyan"; + + # active_column_color = "cyan"; + }; + }; + }; +} -- cgit v1.2.3