2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
2020-11-30 08:33:03 +00:00
|
|
|
, dpkg
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
# The raw package that fetches and extracts the Plex RPM. Override the source
|
|
|
|
# and version of this derivation if you want to use a Plex Pass version of the
|
|
|
|
# server, and the FHS userenv and corresponding NixOS module should
|
|
|
|
# automatically pick up the changes.
|
|
|
|
stdenv.mkDerivation rec {
|
2020-11-19 00:13:47 +00:00
|
|
|
version = "1.20.5.3600-47c0d9038";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "plexmediaserver";
|
|
|
|
|
|
|
|
# Fetch the source
|
2020-11-30 08:33:03 +00:00
|
|
|
src = if stdenv.hostPlatform.system == "aarch64-linux" then fetchurl {
|
|
|
|
url = "https://downloads.plex.tv/plex-media-server-new/${version}/debian/plexmediaserver_${version}_arm64.deb";
|
|
|
|
sha256 = "18zj4baa085gbgc0y5gx7gnwzl131xyk34m5xcipfvfb434y98cp";
|
|
|
|
} else fetchurl {
|
|
|
|
url = "https://downloads.plex.tv/plex-media-server-new/${version}/debian/plexmediaserver_${version}_amd64.deb";
|
|
|
|
sha256 = "01rq2q6avjsvnns7jsd2a9vnmd4584fwdkp833gjgrrrqkf6h45y";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "basedb" ];
|
|
|
|
|
2020-11-30 08:33:03 +00:00
|
|
|
nativeBuildInputs = [ dpkg ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
phases = [ "unpackPhase" "installPhase" "fixupPhase" "distPhase" ];
|
|
|
|
|
|
|
|
unpackPhase = ''
|
2020-11-30 08:33:03 +00:00
|
|
|
dpkg-deb -R $src .
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/lib"
|
|
|
|
cp -dr --no-preserve='ownership' usr/lib/plexmediaserver $out/lib/
|
|
|
|
|
|
|
|
# Location of the initial Plex plugins database
|
|
|
|
f=$out/lib/plexmediaserver/Resources/com.plexapp.plugins.library.db
|
|
|
|
|
|
|
|
# Store the base database in the 'basedb' output
|
|
|
|
cat $f > $basedb
|
|
|
|
|
|
|
|
# Overwrite the base database in the Plex package with an absolute symlink
|
|
|
|
# to the '/db' file; we create this path in the FHS userenv (see the "plex"
|
|
|
|
# package).
|
|
|
|
ln -fs /db $f
|
|
|
|
'';
|
|
|
|
|
|
|
|
# We're running in a FHS userenv; don't patch anything
|
|
|
|
dontPatchShebangs = true;
|
|
|
|
dontStrip = true;
|
|
|
|
dontPatchELF = true;
|
|
|
|
dontAutoPatchelf = true;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = "https://plex.tv/";
|
|
|
|
license = licenses.unfree;
|
2020-11-30 08:33:03 +00:00
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [
|
2020-11-19 00:13:47 +00:00
|
|
|
badmutex
|
2020-04-24 23:36:52 +00:00
|
|
|
colemickens
|
|
|
|
forkk
|
|
|
|
lnl7
|
|
|
|
pjones
|
|
|
|
thoughtpolice
|
|
|
|
];
|
|
|
|
description = "Media library streaming server";
|
|
|
|
longDescription = ''
|
|
|
|
Plex is a media server which allows you to store your media and play it
|
|
|
|
back across many different devices.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|