Raspberry Pi 3 + Nixos 19.03 + Plex: Failed to start Plex Media Server

Hi! I’m really new to NixOS.
I have a Raspberry Pi 3 B+, installed Nixos 19.03.173298.1f22d5b6f87 (Koi) on it and enabled kodi, transmission and plex, but plex doesn’t want to start up.
My configuration.nix:

{ config, pkgs, lib, ... }:
{
  # Needs for Plex install
  nixpkgs.config.allowUnfree = true;

  # NixOS wants to enable GRUB by default
  boot.loader.grub.enable = false;

  # if you have a Raspberry Pi 2 or 3, pick this:
  boot.kernelPackages = pkgs.linuxPackages_latest;

  # A bunch of boot parameters needed for optimal runtime on RPi 3b+
  boot.kernelParams = ["cma=256M"];
  boot.loader.raspberryPi.enable = true;
  boot.loader.raspberryPi.version = 3;
  boot.loader.raspberryPi.uboot.enable = true;
  boot.loader.raspberryPi.firmwareConfig = ''
    gpu_mem=256
  '';
  environment.systemPackages = with pkgs; [
    raspberrypi-tools vim htop
  ];

  # File systems configuration for using the installer's partition layout
  fileSystems = {
    "/boot" = {
      device = "/dev/disk/by-label/NIXOS_BOOT";
      fsType = "vfat";
    };
    "/" = {
      device = "/dev/disk/by-label/NIXOS_SD";
      fsType = "ext4";
    };
  };

  # Preserve space by sacrificing documentation and history
  documentation.nixos.enable = false;
  
  # Garbage collection
  nix.gc.automatic = true;
  nix.gc.dates = "03:15";
  nix.gc.options = "--delete-older-than 30d";

  boot.cleanTmpDir = true;

  # Configure basic SSH access
  services.openssh.enable = true;
  services.openssh.permitRootLogin = "yes";

  # Use 1GB of additional swap memory in order to not run out of memory
  # when installing lots of things while running other things at the same time.
  swapDevices = [ { device = "/swapfile"; size = 1024; } ];

  # Enable X11 windowing system
  services.xserver.enable = true;
  services.xserver.videoDrivers = [ "modesetting" ];
  
  # Enable Kodi
  services.xserver.desktopManager.kodi.enable = true;
  
  # Enable slim autologin
  services.xserver.displayManager.lightdm.enable = true;
  services.xserver.displayManager.lightdm.autoLogin.enable = true;
  services.xserver.displayManager.lightdm.autoLogin.user = "kodi";
  
  # Define a user account
  users.extraUsers.kodi.isNormalUser = true;
  
  services.transmission.enable = true;
  services.plex.enable = true;
}

Logs:

Aug 15 18:34:14 nixos systemd[1]: Starting Plex Media Server...
Aug 15 18:34:14 nixos k7i9hj1imba9hv8xkrh7vf0i16yg2215-unit-script-plex-pre-start[911]: Preparing plugin directory.
Aug 15 18:34:14 nixos k7i9hj1imba9hv8xkrh7vf0i16yg2215-unit-script-plex-pre-start[911]: Removing old symlinks.
Aug 15 18:34:14 nixos k7i9hj1imba9hv8xkrh7vf0i16yg2215-unit-script-plex-pre-start[911]: Symlinking plugins.
Aug 15 18:34:14 nixos systemd[1]: Started Plex Media Server.
Aug 15 18:34:14 nixos systemd[924]: plex.service: Failed to execute command: Exec format error
Aug 15 18:34:14 nixos systemd[924]: plex.service: Failed at step EXEC spawning /nix/store/pzi7qyh36xi6cykmikj7jk7km4ks1dmd-plex-1.14.1.5488/usr/lib/plexmediaserver/Plex Media Server: Exec format error
Aug 15 18:34:14 nixos systemd[1]: plex.service: Main process exited, code=exited, status=203/EXEC
Aug 15 18:34:14 nixos systemd[1]: plex.service: Failed with result 'exit-code'.
Aug 15 18:34:14 nixos systemd[1]: plex.service: Service RestartSec=100ms expired, scheduling restart.
Aug 15 18:34:14 nixos systemd[1]: plex.service: Scheduled restart job, restart counter is at 1.
Aug 15 18:34:14 nixos systemd[1]: Stopped Plex Media Server.
...
Aug 15 18:34:16 nixos systemd[1]: plex.service: Start request repeated too quickly.
Aug 15 18:34:16 nixos systemd[1]: plex.service: Failed with result 'exit-code'.
Aug 15 18:34:16 nixos systemd[1]: Failed to start Plex Media Server.

What it tries to start:

# /nix/store/vq2ip15vz2446mfjk4469a2d14pw9296-unit-plex.service/plex.service
[Unit]
After=network.target
Description=Plex Media Server

[Service]
Environment="LANG=en_US.UTF-8"
Environment="LC_ALL=en_US.UTF-8"
Environment="LD_LIBRARY_PATH=/run/opengl-driver/lib:/nix/store/pzi7qyh36xi6cykmikj7jk7km4ks1dmd-plex-1.14.1.5488/usr/lib/plexmediaserver"
Environment="LOCALE_ARCHIVE=/nix/store/ygmlzapzzjvwm20akjx60f6lshy685bz-glibc-locales-2.27/lib/locale/locale-archive"
Environment="PATH=/nix/store/cib5daqwbsbk6009r7pcpkd0snsf8brx-coreutils-8.30/bin:/nix/store/9753j64axp63316kjvy22nxabish9h9y-findutils-4.6.0/bin:/nix/store/7ibsza7yj11xp1hz4rllmhiv2i3dk1wj-gnugrep-3.3/bi>
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plex"
Environment="PLEX_MEDIA_SERVER_HOME=/nix/store/pzi7qyh36xi6cykmikj7jk7km4ks1dmd-plex-1.14.1.5488/usr/lib/plexmediaserver"
Environment="PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6"
Environment="PLEX_MEDIA_SERVER_TMPDIR=/tmp"
Environment="PLEX_MEDIA_SERVER_USE_SYSLOG=true"
Environment="TZDIR=/nix/store/6w24yrpr7h8lwdv4kscaicignv67hv6j-tzdata-2019a/share/zoneinfo"



ExecStart="/nix/store/pzi7qyh36xi6cykmikj7jk7km4ks1dmd-plex-1.14.1.5488/usr/lib/plexmediaserver/Plex Media Server"
ExecStartPre=/nix/store/k7i9hj1imba9hv8xkrh7vf0i16yg2215-unit-script-plex-pre-start
Group=plex
KillSignal=SIGQUIT
PermissionsStartOnly=true
Restart=on-failure
Type=simple
User=plex

Any guess what could be the problem?

Looking just at the Plex package, it seems to heavily rely on x86_64, since it’s simply a repackaging of the RPM provided by plex.tv. I’m not sure that’ll work on a Pi.

1 Like