How to Install Medusa on NixOS

Medusa is an open-source media server that runs on multiple platforms including NixOS, a Linux distribution that follows the functional programming paradigm. In this tutorial, we will learn how to install Medusa on the latest version of NixOS.

Prerequisites

Before installing Medusa, make sure to have NixOS installed on your system. You also need a stable internet connection to download and install the required packages.

Installing Medusa

  1. Update the system by running the following command in the terminal:
sudo nixos-rebuild switch
  1. Install the latest version of the Medusa package by running the following command:
sudo nix-env -i medusa

That's it! You have successfully installed Medusa on your NixOS system.

Configuring Medusa

To configure Medusa, you need to access the Medusa web interface by typing the following URL on your web browser:

http://localhost:8081/

Once you have accessed the Medusa web interface, you can configure the server settings, add media files, and manage your libraries.

Running Medusa as a Service

To run Medusa as a service on your NixOS system, you need to create a configuration file for the service. Here are the steps to do so:

  1. Create a medusa.nix file by running the following command in the terminal:
sudo nano /etc/nixos/medusa.nix
  1. Paste the following code into the medusa.nix file:
{ config, pkgs, ... }:

{
  services.medusa = {
    enable = true;
    port = 8081;

    config = {
      ip = "0.0.0.0";
      media_dirs = [ "/srv/media" ];
    };
  };
}

This code sets up the Medusa service with a server port of 8081, IP address of 0.0.0.0, and a media directory of /srv/media. You can change these values according to your needs.

  1. Save and exit the file by pressing Ctrl + X, Y, and Enter.

  2. Reload the configuration of your NixOS system by running the following command in the terminal:

sudo nixos-rebuild switch

Now, you can start and stop the Medusa service using the following commands:

sudo systemctl start medusa
sudo systemctl stop medusa

Conclusion

In this tutorial, we learned how to install and configure Medusa on the latest version of NixOS. With Medusa, you can easily organize and manage your media files, and access them from any device on your network.