nixos-config/2configs/bluetooth-mpd.nix

49 lines
1.3 KiB
Nix
Raw Normal View History

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;
# connect via https://nixos.wiki/wiki/Bluetooth#Using_Bluetooth_headsets_with_PulseAudio
2018-03-18 20:37:48 +01:00
hardware.bluetooth.enable = true;
# environment.etc."bluetooth/audio.conf".text = ''
# [General]
# Enable = Source,Sink,Media,Socket
# '';
2018-03-18 20:37:48 +01:00
};
}