Jump to content

Spotify: Difference between revisions

From NixOS Wiki
m adjust headings, replace unfree notice with the one at Template:Unfree, rephrase intro
DoggoBit (talk | contribs)
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Unfree}}
{{tip/unfree}}
 
[https://spotify.com Spotify] is a commercial music streaming service.
[https://spotify.com Spotify] is a commercial music streaming service.


Line 19: Line 20:
networking.firewall.allowedUDPPorts = [ 5353 ];</syntaxhighlight>
networking.firewall.allowedUDPPorts = [ 5353 ];</syntaxhighlight>


== spotifyd ==
== Spotifyd ==
The alternative client [https://github.com/Spotifyd/spotifyd spotifyd] is available as a package, [https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/audio/spotifyd.nix nixos module], and [https://github.com/nix-community/home-manager/blob/master/modules/services/spotifyd.nix home-manager module].
The alternative client [https://github.com/Spotifyd/spotifyd spotifyd] is available as a package, [https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/audio/spotifyd.nix nixos module], and [https://github.com/nix-community/home-manager/blob/master/modules/services/spotifyd.nix home-manager module].


Line 41: Line 42:


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].
=== Troubleshooting ===
If you get: <code>libcurl-gnutls.so.4: no version information</code>, clear your Spotify cache: <code>rm -rf ~/.cache/spotify</code>


[[Category:Applications]]
[[Category:Applications]]

Latest revision as of 20:06, 5 June 2025

🟆︎
Tip: This package is unfree, and will require extra steps to install. You can read more about allowing unfree software in the Nixpkgs Manual.

Spotify is a commercial music streaming service.

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.

Troubleshooting

If you get: libcurl-gnutls.so.4: no version information, clear your Spotify cache: rm -rf ~/.cache/spotify