Nixos 21.11 + Plex + Plexpass

I can’t seem to get the Plexpass version of Plex working on Nixos. I followed this thread, and use the below code in my configuration file. There are no problems when I nixos-rebuild switch, however when I log into the PlexMediaServer hosted on the Nixos machine it says that it is running version 1.24.5.5173 not the version I specify in the configuration file. Furthermore the Plexamp functionality of the server lacks features that the Ubuntu version has.

services.plex = {
    enable = true;
    openFirewall = true;
    package = pkgs.plex.overrideAttrs (x: let
        # see https://www.plex.tv/media-server-downloads/ for 64bit rpm
        version = "1.25.2.5319-c43dc0277";
        sha1 = "7461280af7b2fee330cf59a9d0ba95ff6c58555f";
      in {
        name = "plex-${version}";
        src = pkgs.fetchurl {
          url = "https://downloads.plex.tv/plex-media-server-new/${version}/redhat/plexmediaserver-${version}.x86_64.rpm";
          inherit sha1;
        };
      }
    );
  };

Any idea how to fix this? I’d prefer to run the PlexMediaServer on Nixos instead of Ubuntu.

This code will work instead. You can put it in a file named plex.nix and put it in your config’s imports = [ ./plex.nix ] for example. I just tested it on my laptop, seems to work as intended.

{ pkgs, lib, ... }:
let
  myPlex = pkgs.plex.overrideAttrs (_: rec {
    version = "1.25.2.5319-c43dc0277";
    src = pkgs.fetchurl {
      url = "https://downloads.plex.tv/plex-media-server-new/${version}/redhat/plexmediaserver-${version}.x86_64.rpm";
      sha256 = "sha256-/Mr7U3L/OPbjORzoFXMtWKn0yV22vi4S4uaranoXuPw=";
    };
  });
in
{
  services.plex = {
    enable = true;
    openFirewall = true;
    package = myPlex;
  };
}

Much appreciated thank you.

I may have stumbled across a bug. The above code works when installed a clean Nixos machine (In the case of the above code the Plex Media Server version is "1.25.2.5319-c43dc0277").

However, after nixos-rebuild switch I try upgrading the Plex Media Server version. You can grab the latest url from here (Which is "1.25.3.5385-f05b712b6"). Now run nixos-rebuild switch. I expect to see the new version, but instead I see "1.24.5.5173".

Huh that’s weird. Maybe best to just fall back to "1.25.2.5319-c43dc0277", except I can’t. I am stuck on "1.24.5.5173".

Can someone else replicate?

Try this:

services.plex = let plexpass = pkgs.plex.override {
  plexRaw = pkgs.plexRaw.overrideAttrs(old: rec {
    version = "1.25.8.5621-7a6fed0cf";
    src = pkgs.fetchurl {
      url = "https://downloads.plex.tv/plex-media-server-new/${version}/debian/plexmediaserver_${version}_amd64.deb";
      sha256 = "sha256-BwPYgO4/My6wk3W7/9gXSKKR5bKM1dDKiTdhHlhyvP0=";
    };
  });
}; 
in {
  enable = true;
  openFirewall = true;
  package = plexpass;
};
2 Likes

That did it, thank you!

Why did it work? Why was it not working before?

Previously you were overriding attributes of plex, not plexRaw. But plexRaw is where the attributes src and version are defined, see https://github.com/NixOS/nixpkgs/blob/710fed5a2483f945b14f4a58af2cd3676b42d8c8/pkgs/servers/plex/raw.nix

1 Like