summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bluetooth-mpd.nix
diff options
context:
space:
mode:
authorjeschli <jeschli@gmail.com>2018-04-18 08:19:05 +0200
committerjeschli <jeschli@gmail.com>2018-04-18 08:19:05 +0200
commite800670c1892cca7c9d12476d65bb4750e213890 (patch)
treecf20fc27b3fe7e271d7b0441c880283c91f42e60 /makefu/2configs/bluetooth-mpd.nix
parente3445be6dafe4f16e150549baee34055a6b04fef (diff)
parent5b8c4d24e274bbf26e85420fc11b5bf7e24ac22d (diff)
Merge branch 'master' of prism.r:stockholm
Diffstat (limited to 'makefu/2configs/bluetooth-mpd.nix')
-rw-r--r--makefu/2configs/bluetooth-mpd.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/makefu/2configs/bluetooth-mpd.nix b/makefu/2configs/bluetooth-mpd.nix
new file mode 100644
index 000000000..226f5cf1f
--- /dev/null
+++ b/makefu/2configs/bluetooth-mpd.nix
@@ -0,0 +1,68 @@
+{ 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;
+ # systemWide = true;
+ support32Bit = true;
+ zeroconf.discovery.enable = true;
+ zeroconf.publish.enable = true;
+ tcp = {
+ enable = true;
+ # PULSE_SERVER=192.168.1.11 pavucontrol
+ anonymousClients.allowAll = true;
+ };
+ configFile = pkgs.writeText "default.pa" ''
+ load-module module-udev-detect
+ load-module module-bluetooth-policy
+ load-module module-bluetooth-discover
+ load-module module-native-protocol-unix
+ 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
+ '';
+ };
+ # connect via https://nixos.wiki/wiki/Bluetooth#Using_Bluetooth_headsets_with_PulseAudio
+ hardware.bluetooth.enable = true;
+ #hardware.bluetooth.extraConfig = ''
+ # [general]
+ # Enable=Source,Sink,Media,Socket
+ #'';
+ };
+}