2018-03-18 20:37:48 +01:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.makefu.mpd;
|
|
|
|
in {
|
|
|
|
options.makefu.mpd.musicDirectory = lib.mkOption {
|
|
|
|
description = "music Directory";
|
|
|
|
default = "/data/music";
|
|
|
|
type = lib.types.str;
|
|
|
|
};
|
2024-01-15 22:40:02 +01:00
|
|
|
|
2018-03-18 20:37:48 +01:00
|
|
|
config = {
|
2024-01-15 22:40:02 +01:00
|
|
|
# pipewire workaround for mpd to play music on kiosk user
|
|
|
|
services.mpd.user = "kiosk";
|
|
|
|
systemd.services.mpd.environment = {
|
|
|
|
# https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/609
|
|
|
|
XDG_RUNTIME_DIR = "/run/user/${toString config.users.users.kiosk.uid}";
|
|
|
|
};
|
|
|
|
|
2018-03-18 20:37:48 +01:00
|
|
|
services.mpd = {
|
|
|
|
enable = true;
|
|
|
|
inherit (cfg) musicDirectory;
|
|
|
|
network.listenAddress = "0.0.0.0";
|
|
|
|
extraConfig = ''
|
|
|
|
audio_output {
|
2024-01-15 22:40:02 +01:00
|
|
|
type "pipewire"
|
|
|
|
name "pipewire output"
|
2018-03-18 20:37:48 +01:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
# open because of truestedInterfaces
|
|
|
|
# networking.firewall.allowedTCPPorts = [ 6600 4713 ];
|
|
|
|
services.samba.shares.music = {
|
|
|
|
path = cfg.musicDirectory;
|
|
|
|
"read only" = "no";
|
|
|
|
browseable = "yes";
|
|
|
|
"guest ok" = "yes";
|
|
|
|
};
|
|
|
|
|
|
|
|
sound.enable = true;
|
2018-04-04 14:45:30 +02:00
|
|
|
# connect via https://nixos.wiki/wiki/Bluetooth#Using_Bluetooth_headsets_with_PulseAudio
|
2018-03-18 20:37:48 +01:00
|
|
|
hardware.bluetooth.enable = true;
|
2018-04-04 14:45:30 +02:00
|
|
|
# environment.etc."bluetooth/audio.conf".text = ''
|
|
|
|
# [General]
|
|
|
|
# Enable = Source,Sink,Media,Socket
|
|
|
|
# '';
|
2018-03-18 20:37:48 +01:00
|
|
|
};
|
|
|
|
}
|