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
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;
2024-05-08 21:45:52 +02:00
network.listenAddress = "any";
user = "kiosk"; # run mpd under pipewire user
startWhenNeeded = true;
2018-03-18 20:37:48 +01:00
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;
2024-05-08 21:45:52 +02:00
# connect via https://wiki.nixos.org/wiki/Bluetooth#Using_Bluetooth_headsets_with_PulseAudio
2018-03-18 20:37:48 +01:00
hardware.bluetooth.enable = true;
2024-05-08 21:45:52 +02:00
environment.etc."bluetooth/audio.conf".text = ''
[General]
Enable = Source,Sink,Media,Socket
'';
2018-03-18 20:37:48 +01:00
};
}