How to Install Icecast 2 on NixOS Latest

Icecast 2 is a free and open source streaming media server that allows users to stream audio and video content over the internet. If you are running NixOS Latest and want to install Icecast 2, here’s a step-by-step tutorial on how to do it.

Prerequisites

Before we begin, ensure you have the following prerequisites:

  • A machine running the latest version of NixOS
  • Basic knowledge of the command line

Step 1: Update your system

Ensure your system is up-to-date by running the following command:

sudo nixos-rebuild switch

Step 2: Install Icecast 2

To install Icecast 2, run the following command:

sudo nix-env -iA nixos.icecast

This will download and install the Icecast 2 package and its dependencies.

Step 3: Configure Icecast 2

The next step is to configure Icecast 2 to work with your media files. The configuration file for Icecast 2 is located at /etc/icecast.nix.

sudo nano /etc/icecast.nix

You can add your media files to the configuration file by modifying the <mount> tags. Here’s an example:

<mount name="/stream">
    <audio>
        <filename>/path/to/audio.mp3</filename>
    </audio>
</mount>

This configuration sets up a mount point at /stream for an audio file located at /path/to/audio.mp3.

Step 4: Start Icecast 2

To start the Icecast 2 server, run the following command:

sudo systemctl start icecast

To ensure that Icecast 2 starts automatically when your system boots up, run:

sudo systemctl enable icecast

Conclusion

Icecast 2 is now installed and configured on your NixOS Latest system. You can now use it to stream your media files over the internet.