Spotify: Difference between revisions

From NixOS Wiki
imported>Diogotcorreia
Add firewall instructions to allow local devices to be discovered by the Spotify app
Klinger (talk | contribs)
Sentence explaining Spotify added. Category:Application
Line 1: Line 1:
== Spotify ==
== Spotify ==
Spotify is a commercial music streaming service. Its usable on the Spotify website and via desktop applications.


{{note|Spotify is [[FAQ/unfree|unfree]], its license prohibits distribution. See the [[FAQ/unfree]] page to install unfree software.}}
{{note|Spotify is [[FAQ/unfree|unfree]], its license prohibits distribution. See the [[FAQ/unfree]] page to install unfree software.}}
Line 42: Line 44:


spotifyd connects to spotify as a spotify-connect device. It offers no controls of its own, but can be controlled via [https://github.com/altdesktop/playerctl playerctl]  or [https://github.com/Rigellute/spotify-tui spotify-tui].
spotifyd connects to spotify as a spotify-connect device. It offers no controls of its own, but can be controlled via [https://github.com/altdesktop/playerctl playerctl]  or [https://github.com/Rigellute/spotify-tui spotify-tui].
[[Category:Application]]

Revision as of 11:57, 19 April 2024

Spotify

Spotify is a commercial music streaming service. Its usable on the Spotify website and via desktop applications.


Note: Spotify is unfree, its license prohibits distribution. See the FAQ/unfree page to install unfree software.

Installation

To install the standard Spotify desktop application, add to system packages:

 environment.systemPackages = with pkgs; [
   spotify
 ];

Local discovery

To sync local tracks from your filesystem with mobile devices in the same network, you need to open port 57621 by adding the following line to your configuration.nix:

networking.firewall.allowedTCPPorts = [ 57621 ];

In order to enable discovery of Google Cast devices (and possibly other Spotify Connect devices) in the same network by the Spotify app, you need to open UDP port 5353 by adding the following line to your configuration.nix:

networking.firewall.allowedUDPPorts = [ 5353 ];

spotifyd

The alternative client spotifyd is available as a package, nixos module, and home-manager module.

spotifyd must have your credentials when it starts, otherwise it will not be able to authenticate with Spotify, and will not show up as a device. If installing spotifyd as a package, give it credentials when starting, e.g.:

spotifyd --username <USER> --password <PASS>

If installing spotifyd as a systemd service via home-manager, you can supply your credentials via options. Example home-manager config:

 services.spotifyd = {
   enable = true;
   settings =
     {
       global = {
         username = "Alex";
         password = "foo";
       };
     }
   ;
 }

spotifyd connects to spotify as a spotify-connect device. It offers no controls of its own, but can be controlled via playerctl or spotify-tui.