summaryrefslogtreecommitdiff
path: root/modules/mpd.nix
blob: 7c3c821a8b79a252f7d3f9c689d0b33872b75539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
{
  config,
  lib,
  pkgs,
  ...
}:
with lib;
let
  cfg = config.nixfiles.modules.mpd;
in
{
  options.nixfiles.modules.mpd.enable = mkEnableOption "MPD and its clients.";

  config = mkIf cfg.enable {
    nixfiles.modules.sound.enable = true;

    hm = {
      home.packages = with pkgs; [ mpc_cli ];

      services.mpd = {
        enable = true;
        musicDirectory = "${config.my.home}/music";
        extraConfig = ''
          restore_paused "yes"

          auto_update "no"

          replaygain "album"
          replaygain_preamp "0"
          replaygain_limit "yes"

          volume_normalization "no"

          zeroconf_enabled "no"

          audio_output {
              type "pipewire"
              name "piepwire"
          }
        '';
      };

      programs.ncmpcpp = {
        enable = true;

        settings = rec {
          ncmpcpp_directory = "${config.dirs.data}/ncmpcpp";

          lyrics_directory = "${ncmpcpp_directory}/lyrics";
          lyrics_fetchers = "musixmatch, genius, internet";

          playlist_disable_highlight_delay = 1;
          message_delay_time = 1;

          song_window_title_format = "{%a - }{%t}|{%f}";
          song_list_format = "{$6%t}|{$2%f}$1 $R{$8%b}$1 {$5%a}";
          song_columns_list_format = "(20)[red]{a} (30)[cyan]{b} (50)[blue]{t|f}";
          song_status_format = "{{$8%a$9{ $b-$/b $6%b$9 {(%y)} } - } '{%t}}|{%f}'";
          song_library_format = "{%n - }{%t}|{%f}";

          now_playing_prefix = "$b";
          now_playing_suffix = "$/b";

          selected_item_prefix = "$0";
          selected_item_suffix = "$9";
          modified_item_prefix = "$3> $9";

          browser_playlist_prefix = "$2playlist$9 ";
          browser_sort_format = "{%a - }{%t}|{%f} {(%l)}";

          playlist_show_mpd_host = false;
          playlist_show_remaining_time = false;
          playlist_shorten_total_times = false;
          playlist_separate_albums = false;

          playlist_display_mode = "classic";
          browser_display_mode = "classic";
          search_engine_display_mode = "classic";
          playlist_editor_display_mode = "classic";

          incremental_seeking = true;
          seek_time = 1;

          volume_change_step = 5;

          autocenter_mode = true;
          centered_cursor = true;

          progressbar_look = "=*-";

          default_place_to_search_in = "database";
          search_engine_default_search_mode = 1;
          data_fetching_delay = false;
          media_library_primary_tag = "album_artist";
          browser_sort_mode = "name";
          default_find_mode = "wrapped";
          default_tag_editor_pattern = "%n - %t";
          empty_tag_marker = "<blank>";
          tags_separator = " | ";
          tag_editor_extended_numeration = true;
          media_library_sort_by_mtime = false;
          regular_expressions = "none";
          block_search_constraints_change_if_items_found = true;

          ignore_leading_the = true;

          enable_window_title = false;

          header_visibility = false;
          statusbar_visibility = false;
          titles_visibility = false;

          display_volume_level = false;
          display_bitrate = false;
          display_remaining_time = false;

          cyclic_scrolling = true;
          lines_scrolled = 1;

          follow_now_playing_lyrics = false;
          fetch_lyrics_for_current_song_in_background = false;
          store_lyrics_in_song_dir = false;

          generate_win32_compatible_filenames = false;
          allow_for_physical_item_deletion = false;
          show_hidden_files_in_local_browser = false;

          screen_switcher_mode = "playlist, browser";
          startup_screen = "playlist";
          startup_slave_screen = "";
          startup_slave_screen_focus = false;
          locked_screen_width_part = 50;
          ask_for_locked_screen_width_part = true;

          jump_to_now_playing_song_at_start = false;

          ask_before_clearing_playlists = false;

          clock_display_seconds = false;

          mouse_support = false;

          external_editor = getExe' config.programs.vim.package "vim";
          use_console_editor = true;

          colors_enabled = true;
          discard_colors_if_item_is_selected = true;

          empty_tag_color = "cyan";
          header_window_color = "cyan";
          volume_color = "cyan";
          state_line_color = "cyan";
          state_flags_color = "green";
          main_window_color = "blue";
          color1 = "cyan";
          color2 = "red";
          progressbar_color = "cyan";
          progressbar_elapsed_color = "white";
          statusbar_color = "yellow";
          window_border_color = "green";
          active_window_border = "red";
        };

        bindings = [
          {
            key = "j";
            command = "scroll_down";
          }
          {
            key = "k";
            command = "scroll_up";
          }
          {
            key = "J";
            command = [
              "select_item"
              "scroll_down"
            ];
          }
          {
            key = "K";
            command = [
              "select_item"
              "scroll_up"
            ];
          }
          {
            key = "h";
            command = [
              "previous_column"
              "master_screen"
            ];
          }
          {
            key = "l";
            command = [
              "next_column"
              "slave_screen"
            ];
          }
          {
            key = "g";
            command = "move_home";
          }
          {
            key = "G";
            command = "move_end";
          }
          {
            key = "d";
            command = [
              "delete_playlist_items"
              "delete_browser_items"
              "delete_stored_playlist"
            ];
          }
          {
            key = "L";
            command = "show_lyrics";
          }
          {
            key = "H";
            command = "toggle_lyrics_fetcher";
          }
        ];
      };
    };
  };
}