How to Install Mopidy on nixOS Latest

In this tutorial, we will walk through the steps to install Mopidy on nixOS Latest. Mopidy is an extensible music server written in Python. It plays music from local disk, Spotify, SoundCloud and many other streaming services.

Prerequisites

  • A computer running nixOS Latest
  • Administrative access to the computer

Step 1: Install Mopidy

  1. Run the terminal and update the nixOS package manager by typing

    sudo nix-channel --update
    
  2. Install Mopidy by running this command:

    sudo nix-env -i mopidy
    
  3. The installation will take a few minutes. Once completed, verify the latest version of Mopidy installed by running the command below in the terminal:

    mopidy --version
    

Step 2: Configure Mopidy

  1. Create the configuration file for Mopidy by running the following command:

    touch ~/.config/mopidy/mopidy.conf
    
  2. Open the configuration file using a text editor of choice:

    nano ~/.config/mopidy/mopidy.conf
    
  3. Inside the configuration file, add the following content:

    [audio]
    output = autoaudiosink
    
    [spotify]
    username = <your spotify username>
    password = <your spotify password>
    

    Replace the username and password fields with your personal Spotify account credentials.

    Note: If you don't have Spotify Premium, you don't need to fill in the Spotify section of the configuration file.

  4. Save and close the configuration file using Ctrl + O and Ctrl + X.

Step 3: Start Mopidy

  1. Start Mopidy by running the following command:

    mopidy
    
  2. If all goes well, Mopidy should start playing your local music library or random tracks from the supported streaming services.

    Note: If you want to stop Mopidy, press Ctrl + C in the terminal.

Conclusion

Congratulations, you have successfully installed Mopidy on nixOS Latest! Enjoy listening to your favorite music streaming services!