githubEdit

Nix Flakes [Community]

circle-info

This is a community contribution and not officially supported by the MediaManager team, but included here for convenience.

Please report issues with this method at the corresponding GitHub repositoryarrow-up-right.

Prerequisites

This guide assumes that your system is a flakes-based NixOS installation. Hosting MediaManager on a subpath (e.g. yourdomain.com/mediamanager) is currently not supported, though contributions to add support are welcome.

Importing the community flake

To use the community-provided flake and module, first import it in your own flake, for example:

{
  description = "An example NixOS configuration";

  inputs = {
    nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; };
    
    mediamanager-nix = {
      url = "github:strangeglyph/mediamanager-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = inputs@{
    nixpkgs,
    mediamanager-nix,
    ...
  }: {
    nixosConfigurations.your-system = nixpkgs.lib.nixosSystem {
      modules = [
        mediamanager-nix.nixosModules.default
      ];
    };
  };
}

Configuration

The flake provides a simple module to set up a MediaManager systemd service. To enable it, set

You will either want to set services.media-manager.dataDir, which will provide sensible defaults for the settings misc.{image,movie,tv,torrent}_directory, or provide specific paths yourself.

The host and port that MediaManager listens on can be set using services.media-manager.{host,port}.

To configure MediaManager, use services.media-manager.settings, which follows the same structure as the MediaManager config.toml. To provision secrets, set services.media-manager.environmentFile to a protected file, for example one provided by agenixarrow-up-right or sops-nixarrow-up-right. See Configurationarrow-up-right for guidance on using environment variables.

circle-exclamation

Automatic Postgres Setup

As a convenience feature, the module provides a simple Postgres setup that can be enabled with services.media-manager.postgres.enable. This sets up a database user named services.media-manager.postgres.user and a database with the same name. Provided the user of the systemd service wasn't changed, authentication should work automatically for unix socket connections (the default mediamanager-nix settings).

For advanced setups, please refer to the NixOS manual.

Example Configuration

Here is a minimal complete flake for a MediaManager setup:

Last updated