From 5d2d3ce279605b89553df6d159cb84e113ed709c Mon Sep 17 00:00:00 2001 From: Pascal Bach Date: Thu, 18 Aug 2022 22:31:16 +0200 Subject: [PATCH] plex: use buildFHSUserEnvBubblewrap Switch the plex server to use buildFHSUserEnvBubblewrap. Still requires shared PID namespace as plex refuses to start otherwise, it thinks it's already running. --- pkgs/servers/plex/default.nix | 10 ++++++++-- pkgs/top-level/all-packages.nix | 5 ++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/servers/plex/default.nix b/pkgs/servers/plex/default.nix index 1855ac1af54d..b989959b6255 100644 --- a/pkgs/servers/plex/default.nix +++ b/pkgs/servers/plex/default.nix @@ -1,6 +1,6 @@ # The actual Plex package that we run is a FHS userenv of the "raw" package. { stdenv -, buildFHSUserEnv +, buildFHSUserEnvBubblewrap , writeScript , plexRaw @@ -9,10 +9,16 @@ , dataDir ? "/var/lib/plex" }: -buildFHSUserEnv { +buildFHSUserEnvBubblewrap { name = "plexmediaserver"; + inherit (plexRaw) meta; + # Plex does some magic to detect if it is already running. + # The separate PID namespace somehow breaks this and Plex is thinking it's already + # running and refuses to start. + unsharePid = false; + # This script is run when we start our Plex binary runScript = writeScript "plex-run-script" '' #!${stdenv.shell} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 54a73b520bcc..229af2bb6044 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9817,9 +9817,8 @@ with pkgs; inherit (callPackage ../servers/plik { }) plik plikd; - plex = callPackage ../servers/plex { - buildFHSUserEnv = buildFHSUserEnvBubblewrap; - }; + plex = callPackage ../servers/plex { }; + plexRaw = callPackage ../servers/plex/raw.nix { }; psitransfer = callPackage ../servers/psitransfer { };