From c7cc9ab029d6f8002d501a877287387d4257cdd7 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sun, 4 Aug 2024 03:52:29 +0200 Subject: [PATCH] georg: enable spotifyd --- hosts/georg/configuration.nix | 1 + modules/spotifyd.nix | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 modules/spotifyd.nix diff --git a/hosts/georg/configuration.nix b/hosts/georg/configuration.nix index 9b41740..e8d613f 100644 --- a/hosts/georg/configuration.nix +++ b/hosts/georg/configuration.nix @@ -7,6 +7,7 @@ ../../misc/metrics-exporters.nix ../../modules/grzegorz.nix + ../../modules/spotifyd.nix ]; boot.loader.systemd-boot.enable = true; diff --git a/modules/spotifyd.nix b/modules/spotifyd.nix new file mode 100644 index 0000000..232a38b --- /dev/null +++ b/modules/spotifyd.nix @@ -0,0 +1,44 @@ +{ lib, config, ... }: + +{ + + services.spotifyd.enable = true; + # https://docs.spotifyd.rs/config/File.html + services.spotifyd.settings = { + device_name = "${config.networking.hostName}-spotifyd"; + device_type = "t_v"; # in ["unknown" "computer" "tablet" "smartphone" "speaker" "t_v"], + bitrate = 160; # in [96 160 320] + volume_normalisation = true; + zeroconf_port = 44677; # instead of user/password + + # this is the place you add blinkenlights + #on_song_change_hook = "rm -rf / --no-preserve-root"; + }; + + systemd.services.spotifyd.serviceConfig = { + SupplementaryGroups = [ + "audio" + "pipewire" + ]; + }; + + services.avahi.enable = true; + services.avahi.publish.enable = true; + services.avahi.publish.addresses = true; + services.avahi.publish.domain = true; + services.avahi.extraServiceFiles.spotifyd = '' + + + + %h + + _spotify-connect._tcp + ${builtins.toString config.services.spotifyd.settings.zeroconf_port} + + + ''; + + networking.firewall.allowedTCPPorts = [ config.services.spotifyd.settings.zeroconf_port ]; + networking.firewall.allowedUDPPorts = [ 5353 ]; # mDNS + +}