2024-07-13 22:08:21 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
2024-07-15 09:27:55 +02:00
|
|
|
pkgs,
|
2024-07-13 22:08:21 +02:00
|
|
|
...
|
|
|
|
}: let
|
2024-07-20 13:56:02 +02:00
|
|
|
cfg = config.modules.usrEnv.services.media.mpd;
|
2024-07-13 22:08:21 +02:00
|
|
|
inherit (config.modules.other.system) username;
|
2024-07-20 13:56:02 +02:00
|
|
|
inherit (lib) mkIf;
|
2024-07-13 22:08:21 +02:00
|
|
|
in {
|
|
|
|
config = mkIf cfg.enable {
|
2024-11-03 23:35:35 +01:00
|
|
|
environment.systemPackages = [pkgs.mpc];
|
2024-07-13 23:22:14 +02:00
|
|
|
systemd.services.mpd.environment = {
|
|
|
|
# https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/609
|
|
|
|
XDG_RUNTIME_DIR = "/run/user/1000";
|
|
|
|
};
|
|
|
|
services.mpd = {
|
|
|
|
enable = true;
|
|
|
|
inherit (cfg) musicDirectory;
|
|
|
|
user = username;
|
2024-07-21 13:18:00 +02:00
|
|
|
startWhenNeeded = true;
|
2024-07-13 23:22:14 +02:00
|
|
|
extraConfig = ''
|
|
|
|
restore_paused "yes"
|
2024-07-21 13:18:00 +02:00
|
|
|
auto_update "yes"
|
|
|
|
playlist_directory "${cfg.musicDirectory}/.playlists"
|
2024-07-13 22:08:21 +02:00
|
|
|
|
2024-07-21 13:18:00 +02:00
|
|
|
audio_output {
|
|
|
|
type "pipewire"
|
|
|
|
name "PipeWire Sound Server"
|
|
|
|
}
|
2024-07-13 23:22:14 +02:00
|
|
|
|
2024-07-21 13:18:00 +02:00
|
|
|
audio_output {
|
|
|
|
type "fifo"
|
|
|
|
name "FIFO"
|
|
|
|
path "/tmp/mpd.fifo"
|
|
|
|
format "44100:16:2"
|
|
|
|
}
|
2024-07-13 23:22:14 +02:00
|
|
|
'';
|
|
|
|
};
|
2024-07-13 22:08:21 +02:00
|
|
|
};
|
|
|
|
}
|