nichts/modules/services/mpd.nix

59 lines
1.3 KiB
Nix
Raw Normal View History

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-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
'';
};
home-manager.users.${username} = {
2024-07-20 13:56:02 +02:00
home.Packages = with pkgs; [mpc-cli];
2024-07-13 23:22:14 +02:00
services = {
2024-07-13 22:08:21 +02:00
mpd-mpris = {
enable = true;
mpd = {
host = "127.0.0.1";
network = "unix";
port = 6600;
useLocal = true;
};
};
playerctld = {
enable = true;
};
};
};
};
}