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;
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
services.mpd = {
|
|
|
|
enable = true;
|
|
|
|
inherit (cfg) musicDirectory;
|
|
|
|
network.listenAddress = "0.0.0.0";
|
|
|
|
extraConfig = ''
|
|
|
|
audio_output {
|
|
|
|
type "pulse"
|
|
|
|
name "Local MPD"
|
|
|
|
server "127.0.0.1"
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
# 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;
|
|
|
|
hardware.pulseaudio = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.pulseaudioFull;
|
2018-04-04 14:45:30 +02:00
|
|
|
# systemWide = true;
|
2018-03-18 20:37:48 +01:00
|
|
|
support32Bit = true;
|
|
|
|
zeroconf.discovery.enable = true;
|
|
|
|
zeroconf.publish.enable = true;
|
|
|
|
tcp = {
|
|
|
|
enable = true;
|
|
|
|
# PULSE_SERVER=192.168.1.11 pavucontrol
|
|
|
|
anonymousClients.allowAll = true;
|
2018-04-04 14:45:30 +02:00
|
|
|
anonymousClients.allowedIpRanges = [ "127.0.0.1" "192.168.0.0/16" ];
|
2018-03-18 20:37:48 +01:00
|
|
|
};
|
|
|
|
configFile = pkgs.writeText "default.pa" ''
|
|
|
|
load-module module-udev-detect
|
|
|
|
load-module module-bluetooth-policy
|
|
|
|
load-module module-bluetooth-discover
|
2018-04-04 14:45:30 +02:00
|
|
|
load-module module-native-protocol-unix auth-anonymous=1
|
2018-03-18 20:37:48 +01:00
|
|
|
load-module module-always-sink
|
|
|
|
load-module module-console-kit
|
|
|
|
load-module module-systemd-login
|
|
|
|
load-module module-intended-roles
|
|
|
|
load-module module-position-event-sounds
|
|
|
|
load-module module-filter-heuristics
|
|
|
|
load-module module-filter-apply
|
|
|
|
load-module module-switch-on-connect
|
2018-11-05 13:55:24 +01:00
|
|
|
load-module module-equalizer-sink
|
|
|
|
load-module module-dbus-protocol
|
2018-04-04 14:45:30 +02:00
|
|
|
#load-module module-bluez5-device
|
|
|
|
#load-module module-bluez5-discover
|
2018-03-18 20:37:48 +01:00
|
|
|
'';
|
|
|
|
};
|
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
|
|
|
};
|
|
|
|
}
|