nixos-config/users/simon/modules/mpd.nix

84 lines
2.1 KiB
Nix
Raw Normal View History

{ config, lib, nixosConfig, pkgs, ... }:
2020-11-07 15:27:13 +01:00
2021-01-30 13:27:29 +01:00
# I only use mpd on gui systems. If I should ever need it on a headless system,
# I will add a separate option.
lib.mkIf nixosConfig.sbruder.gui.enable {
2020-11-07 15:27:13 +01:00
services.mpd = {
enable = true;
2021-12-01 18:24:04 +01:00
package = pkgs.mpd;
musicDirectory = "${config.home.homeDirectory}/Music";
playlistDirectory = "${config.services.mpd.musicDirectory}/playlists";
2020-12-05 18:53:35 +01:00
network.listenAddress = "${config.services.mpd.dataDir}/socket";
2020-11-07 15:27:13 +01:00
extraConfig = ''
zeroconf_enabled "no"
restore_paused "yes"
audio_output {
2021-11-20 16:44:54 +01:00
type "pipewire"
name "pipewire"
2020-11-07 15:27:13 +01:00
}
audio_output {
type "fifo"
name "fifo"
path "${config.services.mpd.dataDir}/fifo"
format "44100:16:2"
}
'';
};
programs.ncmpcpp = {
enable = true;
package = (pkgs.ncmpcpp.override {
visualizerSupport = true;
taglibSupport = false;
});
2020-11-07 15:27:13 +01:00
mpdMusicDir = null; # does not work (not of type `null or path')
settings = {
2020-12-05 18:53:35 +01:00
# Connection
2021-02-27 17:50:14 +01:00
mpd_host = config.services.mpd.network.listenAddress;
2020-12-05 18:53:35 +01:00
2020-11-07 15:27:13 +01:00
# Visualizer
visualizer_autoscale = true;
visualizer_data_source = "${config.services.mpd.dataDir}/fifo";
2020-11-07 15:27:13 +01:00
visualizer_in_stereo = "yes";
visualizer_look = "";
2020-11-07 15:27:13 +01:00
visualizer_output_name = "fifo";
visualizer_spectrum_dft_size = 1;
2020-11-07 15:27:13 +01:00
# Song list formatting
song_columns_list_format = lib.concatStringsSep " " [
2020-11-07 15:27:13 +01:00
"(6f)[green]{NE}"
"(45)[white]{t|f:Title}"
"(20)[]{a}"
"(25)[cyan]{b}"
"(5f)[blue]{P}"
"(7f)[magenta]{l}"
];
# Display lists in column mode by default
browser_display_mode = "columns";
search_engine_display_mode = "columns";
# Faster seeking
seek_time = 5;
# More modern UI
user_interface = "alternative";
2021-07-02 18:02:41 +02:00
# Lyrics
lyrics_directory = "${config.services.mpd.musicDirectory}/lyrics";
2021-07-02 18:02:41 +02:00
# Misc
external_editor = "nvim";
2020-11-07 15:27:13 +01:00
};
};
home.packages = with pkgs; [
mpc_cli
];
home.sessionVariables.MPD_HOST = config.services.mpd.network.listenAddress;
2020-11-07 15:27:13 +01:00
}