50 lines
1.0 KiB
Nix
50 lines
1.0 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.roles.spotifyd;
|
|
in
|
|
{
|
|
options.roles.spotifyd = {
|
|
enable = mkEnableOption "Enable the spotifyd role";
|
|
deviceType = mkOption {
|
|
default = "computer";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable
|
|
{
|
|
roles.audio.enable = true;
|
|
hardware.pulseaudio.enable = true;
|
|
hardware.pulseaudio.extraConfig = ''
|
|
unload-module module-native-protocol-unix
|
|
load-module module-native-protocol-unix auth-anonymous=1
|
|
'';
|
|
hardware.pulseaudio.systemWide = true;
|
|
|
|
services.spotifyd = {
|
|
enable = true;
|
|
settings = {
|
|
global = {
|
|
use_mpris = false;
|
|
backend = "pulseaudio";
|
|
bitrate = 320;
|
|
cache_path = "";
|
|
zeroconf_port = 5354;
|
|
autoplay = false;
|
|
device_type = cfg.deviceType;
|
|
};
|
|
};
|
|
};
|
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
5354
|
|
57621
|
|
];
|
|
networking.firewall.allowedUDPPorts = [
|
|
5353
|
|
];
|
|
};
|
|
}
|