From 326d2622c1bb67e2f5b9654f0d626fc752cce1d0 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Sun, 4 Aug 2024 17:56:03 +0200 Subject: usecases/music: remove mpd, adapt sway keybindings --- usecases/desktop/music.nix | 212 ++++++++++++--------------------------------- 1 file changed, 57 insertions(+), 155 deletions(-) (limited to 'usecases') diff --git a/usecases/desktop/music.nix b/usecases/desktop/music.nix index 7d5706b..a988601 100644 --- a/usecases/desktop/music.nix +++ b/usecases/desktop/music.nix @@ -1,166 +1,68 @@ -_inputs: { - config, +_inputs: +{ lib, 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; - }; - +}: +{ users.extraUsers.minijackson.packages = [ - (pkgs.writeScriptBin - "split-cue" - (builtins.readFile ../../res/scripts/split-cue.sh)) + (pkgs.writeScriptBin "split-cue" (builtins.readFile ../../res/scripts/split-cue.sh)) ]; - home-manager.users.minijackson = {config, ...}: { - programs.beets = { - enable = true; - - settings = { - plugins = [ - "absubmit" - "badfiles" - "chroma" - "convert" - "edit" - "export" - "fetchart" - "fromfilename" - "lastgenre" - "mbsubmit" - "mbsync" - "missing" - "mpdupdate" - "parentwork" - "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"; + home-manager.users.minijackson = + { config, ... }: + { + programs.beets = { + enable = true; + + settings = { + plugins = [ + "absubmit" + "badfiles" + "chroma" + "convert" + "edit" + "export" + "fetchart" + "fromfilename" + "lastgenre" + "mbsubmit" + "mbsync" + "missing" + "mpdupdate" + "parentwork" + "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"; }; - 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"; - }; + wayland.windowManager.sway.config.keybindings = + let + inherit (config.wayland.windowManager.sway.config) modifier; + playerctl = lib.getExe pkgs.playerctl; + in + lib.mkOptionDefault { + "XF86AudioPlay" = "exec ${playerctl} play-pause"; + "XF86AudioPrev" = "exec ${playerctl} previous"; + "XF86AudioNext" = "exec ${playerctl} next"; + + "${modifier}+KP_5" = "exec ${playerctl} play-pause"; + "${modifier}+KP_4" = "exec ${playerctl} previous"; + "${modifier}+KP_6" = "exec ${playerctl} next"; + "${modifier}+KP_8" = "exec ${playerctl} stop"; + }; }; - - wayland.windowManager.sway.config.keybindings = let - inherit (config.wayland.windowManager.sway.config) modifier; - mpc = "${pkgs.mpc_cli}/bin/mpc"; - in - lib.mkOptionDefault { - "XF86AudioPlay" = "exec ${mpc} toggle"; - "XF86AudioPrev" = "exec ${mpc} prev"; - "XF86AudioNext" = "exec ${mpc} next"; - - "${modifier}+KP_5" = "exec ${mpc} toggle"; - "${modifier}+KP_4" = "exec ${mpc} prev"; - "${modifier}+KP_6" = "exec ${mpc} next"; - "${modifier}+KP_8" = "exec ${mpc} stop"; - }; - }; } -- cgit v1.2.3