How to Install MPD on NixOS Latest
MPD (Music Player Daemon) is a free, open-source, and flexible music player server that runs on various platforms, including NixOS. In this tutorial, we will guide you through the process of installing MPD on NixOS Latest.
Prerequisites
- A running NixOS Latest system
- A user account with sudo privileges
Installing MPD on NixOS Latest
Open a terminal emulator on your NixOS system.
Update the package lists:
sudo nix-channel --updateInstall MPD and its dependencies:
sudo nix-env -iA nixos.mpdVerify that MPD has been installed successfully:
mpd --versionIf the command returns the version number of MPD, the installation was successful.
Configure MPD
MPD's configuration file is located at
/etc/mpd.conf. Before starting MPD, you need to configure it according to your preferences. You can use any editor to modify the/etc/mpd.conffile.Here is an example configuration that you can use as a starting point:
# This is the MPD configuration file # See https://www.musicpd.org/doc/user/config_file.html for documentation # General music daemon options # See https://www.musicpd.org/doc/user/daemon.html for documentation music_directory "/home/username/Music" playlist_directory "/home/username/.mpd/playlists" db_file "/var/lib/mpd/tag_cache" log_file "/var/log/mpd/mpd.log" pid_file "/run/mpd/pid" state_file "/var/lib/mpd/state" audio_output { type "alsa" name "My ALSA Device" }Once you have made your changes to
/etc/mpd.conf, save the file and exit the editor.Start MPD:
sudo systemctl start mpdThis will start the MPD service.
Verify that MPD is running:
systemctl status mpdIf MPD is running, you should see output similar to the following:
● mpd.service - Music Player Daemon Loaded: loaded (/nix/store/.../mpd.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2022-04-27 09:37:40 CEST; 29s ago Main PID: 18969 (mpd) Tasks: 4 (limit: 9839) Memory: 21.5M CGroup: /system.slice/mpd.service └─18969 /nix/store/.../bin/mpd --no-daemon Apr 27 09:37:40 nixos systemd[1]: Started Music Player Daemon.
Conclusion
You have successfully installed MPD on NixOS Latest and configured it to your needs. You can now start using MPD to listen to your music collection. Enjoy!