Jellyfin On NixOS With Docker

There is no need for a long introduction here. This is the contents of my jellyfin.nix file. All of the data is saved on an external (encrypted) SSD, called /media.

{ config, pkgs, ... }:

{

  # Jellyfin
  virtualisation.oci-containers.containers."jellyfin" = {
    autoStart = true;
    image = "jellyfin/jellyfin";
    volumes = [
      "/media/Containers/Jellyfin/config:/config"
      "/media/Containers/Jellyfin/cache:/cache"
      "/media/Containers/Jellyfin/log:/log"
      "/media/Movies:/movies"
      "/media/TV-Series:/tv"
    ];
    ports = [ "8096:8096" ];
    environment = {
      JELLYFIN_LOG_DIR = "/log";
    };
  };

}

Since that's in its own .nix file, we need to add it to the imports section of the /etc/nixos/configuration.nix, like so:

imports = [
  ./hardware-configuration.nix
  # Docker containers
  ./containers/jellyfin.nix
];

That's it! Run sudo nixos-rebuild switch and, once it downloads and starts, you should have a running Jellyfin container on your NixOS box!

My YouTube Channel

<< Articles