2024-09-18 15:26:17 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
2024-09-28 21:33:11 -04:00
|
|
|
}: let
|
|
|
|
inherit (config.vars) mainUser;
|
|
|
|
in {
|
2024-09-18 15:26:17 -04:00
|
|
|
hardware.bluetooth = {
|
|
|
|
enable = true;
|
|
|
|
powerOnBoot = true;
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
General = {
|
|
|
|
DiscoverableTimeout = 0;
|
|
|
|
Experimental = true;
|
|
|
|
KernelExperimental = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
Policy.AutoEnable = "true";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-09-28 21:33:11 -04:00
|
|
|
# Have pulseaudio and spotifyd start at boot but after bluetooth
|
2024-09-18 15:26:17 -04:00
|
|
|
# so bluetooth accepts sound connections from the start.
|
2024-09-28 21:33:11 -04:00
|
|
|
users.users.${mainUser}.linger = true;
|
|
|
|
systemd.user.services = {
|
|
|
|
pulseaudio.after = ["bluetooth.service"];
|
|
|
|
spotifyd.after = ["pulseaudio.service"];
|
|
|
|
};
|
|
|
|
systemd.user.targets.default.wants = [
|
|
|
|
"pulseaudio.service"
|
|
|
|
"spotifyd.service"
|
|
|
|
];
|
2024-09-18 15:26:17 -04:00
|
|
|
|
|
|
|
# Allow pulseaudio to be managed by MPD
|
|
|
|
hardware.pulseaudio = {
|
|
|
|
enable = true;
|
|
|
|
|
2024-09-23 16:37:37 -04:00
|
|
|
zeroconf = {
|
|
|
|
discovery.enable = true;
|
|
|
|
publish.enable = true;
|
|
|
|
};
|
|
|
|
|
2024-09-18 15:26:17 -04:00
|
|
|
extraConfig = ''
|
|
|
|
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
2024-09-19 13:36:02 -04:00
|
|
|
upower.enable = true;
|
|
|
|
|
2024-09-18 15:26:17 -04:00
|
|
|
mpd = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
network = {
|
|
|
|
listenAddress = "127.0.0.1";
|
|
|
|
port = 6600;
|
|
|
|
};
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
audio_output {
|
|
|
|
type "pulse"
|
|
|
|
name "UE Boom 2"
|
|
|
|
sink "bluez_sink.88_C6_26_93_4B_77.a2dp_sink"
|
|
|
|
server "127.0.0.1"
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
2024-09-28 21:33:11 -04:00
|
|
|
};
|
2024-09-18 15:26:17 -04:00
|
|
|
|
2024-09-28 21:33:11 -04:00
|
|
|
home-manager.users.${mainUser}.services.spotifyd = {
|
|
|
|
enable = true;
|
2024-09-18 15:26:17 -04:00
|
|
|
|
2024-09-28 21:33:11 -04:00
|
|
|
package = pkgs.spotifyd.override {
|
|
|
|
withMpris = false;
|
|
|
|
withKeyring = false;
|
2024-09-18 15:26:17 -04:00
|
|
|
};
|
|
|
|
|
2024-09-28 21:33:11 -04:00
|
|
|
settings.global = {
|
|
|
|
device_name = config.networking.hostName + " connect";
|
|
|
|
device_type = "speaker";
|
|
|
|
|
|
|
|
zeroconf_port = 33798;
|
|
|
|
|
|
|
|
autoplay = false;
|
|
|
|
backend = "pulseaudio";
|
|
|
|
bitrate = 320;
|
|
|
|
no_audio_cache = true;
|
|
|
|
volume_normalisation = false;
|
|
|
|
};
|
2024-09-18 15:26:17 -04:00
|
|
|
};
|
|
|
|
}
|