about summary refs log tree commit diff
path: root/modules/nixos/mpd.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-02-19 17:50:35 +0300
committerAzat Bahawi <azat@bahawi.net>2023-02-19 17:50:35 +0300
commit91fb4f28ef5d87e8bcf7749928d30ba4a9cbbd34 (patch)
treee07291fcb1cf62a561ffe58d1fd8e2968ff6fcb3 /modules/nixos/mpd.nix
parent2023-02-15 (diff)
2023-02-19
Diffstat (limited to 'modules/nixos/mpd.nix')
-rw-r--r--modules/nixos/mpd.nix212
1 files changed, 212 insertions, 0 deletions
diff --git a/modules/nixos/mpd.nix b/modules/nixos/mpd.nix
new file mode 100644
index 0000000..4b49213
--- /dev/null
+++ b/modules/nixos/mpd.nix
@@ -0,0 +1,212 @@
+{
+  config,
+  lib,
+  pkgs,
+  ...
+}:
+with lib; let
+  cfg = config.nixfiles.modules.mpd;
+in {
+  options.nixfiles.modules.mpd.enable =
+    mkEnableOption "Wether to enable MPD and its clients.";
+
+  config = mkIf cfg.enable {
+    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";
+
+          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 = "${config.programs.vim.package}/bin/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";
+          }
+        ];
+      };
+    };
+  };
+}

Consider giving Nix/NixOS a try! <3