{ config, lib, pkgs, ... }: with lib; let cfg = config.roles.spotifyd; in { options.roles.spotifyd = { enable = mkEnableOption "Enable the spotifyd role"; }; config = mkIf cfg.enable { roles.audio.enable = true; services.spotifyd = { enable = true; settings = { global = { use_mpris = false; backend = "alsa"; device = "sysdefault"; bitrate = 320; cache_path = ""; zeroconf_port = 1234; autoplay = false; }; }; }; networking.firewall.allowedTCPPorts = [ 1234 57621 ]; networking.firewall.allowedUDPPorts = [ 5353 ]; }; }