nixos-config/modules/mpd.nix

55 lines
1.2 KiB
Nix
Raw Normal View History

2020-08-22 17:44:39 +02:00
{ pkgs, ... }:
let
mpdConf = pkgs.writeText "mpd.conf" ''
music_directory "~/Music"
playlist_directory "~/.mpd/playlists"
db_file "~/.mpd/tag_cache"
state_file "~/.mpd/state"
sticker_file "~/.mpd/sticker.sql"
bind_to_address "127.0.0.1"
zeroconf_enabled "no"
restore_paused "yes"
replaygain "track"
auto_update "yes"
audio_output {
type "pulse"
name "pulse"
}
audio_output {
type "fifo"
name "fifo"
path "~/.mpd/fifo"
format "44100:16:2"
}
'';
in
{
imports = [
./pulseaudio.nix
];
systemd.user.services.mpd = {
after = [ "network.target" "sound.target" ];
description = "Music Player Daemon";
wantedBy = [ "default.target" ];
partOf = [ "default.target" ];
serviceConfig = {
ExecStart = "${pkgs.mpd}/bin/mpd --no-daemon ${mpdConf}";
Type = "notify";
ExecStartPre = ''${pkgs.bash}/bin/bash -c "${pkgs.coreutils}/bin/mkdir -p ~/Music ~/.mpd/playlists"'';
};
};
environment.systemPackages = with pkgs; [
mpc_cli
(pkgs.ncmpcpp.override { visualizerSupport = true; taglibSupport = false; })
];
}