Plex: Difference between revisions

imported>Garbas
mNo edit summary
Ponder (talk | contribs)
Copyedit, add Plexamp client
 
(7 intermediate revisions by 5 users not shown)
Line 3: Line 3:
== Basic setup ==
== Basic setup ==


Plex is pre-packaged on NixOS already. All you need is to edit your <code>configuration.nix</code>. A simple configuration looks like
Plex is packaged in Nix. All you need is to edit your <code>configuration.nix</code>. A simple configuration looks like:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 14: Line 14:
After adding this to your <code>configuration.nix</code> just rebuild your system.
After adding this to your <code>configuration.nix</code> just rebuild your system.


Of course there's some more [https://search.nixos.org/options/?query=plex options] that you can customize.
Of course there's some more [https://search.nixos.org/options?query=plex options] that you can customize.


If your Plex media server is behind a router, you'll need to forward tcp port <code>32400</code> to your Plex media server.
If your Plex media server is behind a router, you'll need to forward TCP port <code>32400</code> to your Plex media server.


Access Plex media server by browsing to <code>http://lan_ip:32400/web</code>
Access Plex media server by browsing to <code>http://lan_ip:32400/web</code>


== Plex Media Player (PMP) ==
=== Allow Plex to read external drives ===


Plex Media Player is the current release of Plex's media client. Plex has made PMP [https://www.plex.tv/blog/plex-media-player-now-ambidextrous-free-kodi-said/ available] to all users and it has also become compatible with Kodi.
You might encounter permission issues when you try to access external drives if you haven't configured anything else with the server yet. If you haven't explicitly set up a mounting configuration for your drives and instead have your desktop environment (e.g. GNOME or KDE) automatically mount it when you try accessing it via their file explorers, Plex won't be able to access the drive. This is because the desktop environment mounts it to your user, while Plex runs by default as the "plex" user.


'''Installation'''
The easiest way to allow Plex to see these external drives is to change the Plex service's user . Here is an example:
<syntaxhighlight lang="nix">
services.plex = {
  enable = true;
  openFirewall = true;
  user="yourusername";
};
</syntaxhighlight>


<syntaxhighlight lang="console">
If you have changed the user option after you have already installed Plex, you have to change the permissions of the folder /var/lib/plex via chown to the user you set it to by doing this:
$ nix-env -i plex-media-server
<syntaxhighlight lang="nix">
  sudo chown -R /var/lib/plex  
</syntaxhighlight>
</syntaxhighlight>


== SSL Access via Nginx Revers Proxy ==
The alternative to this is to explicitly mount the drives via [[Filesystems]]. This takes more effort to set up and requires every new drive you want plex to see to be explicitly declared, but allows more control in what Plex is allowed to see.


Because of several redirects within Plex media server it's not easy to make it accessible through SSL. Browser can complain, even if you have configured propler SSL certificates in your plex setup.
== Clients ==
 
[https://www.plex.tv/blog/plex-media-player-now-ambidextrous-free-kodi-said/ Plex Media Player] is Plex's media client, packaged in Nix as plex-media-player.
 
Plex also provide Plexamp for music. It's packaged in Nix but (as of August 2024) only for x86_64.
 
== SSL access via Nginx reverse proxy ==
 
Because of several redirects within Plex media server it's not easy to make it accessible through SSL. The browser can complain, even if you have configured proper SSL certificates in your Plex setup.


Fortunately [https://www.nginx.com/ Nginx] can be used as a reverse proxy server to access Plex media server. Most of the configuration below comes from [https://forums.plex.tv/t/how-to-setup-nginx-as-a-reverse-proxy-for-plex/212702/2 kopfpilot] on the Plex forum.
Fortunately [https://www.nginx.com/ Nginx] can be used as a reverse proxy server to access Plex media server. Most of the configuration below comes from [https://forums.plex.tv/t/how-to-setup-nginx-as-a-reverse-proxy-for-plex/212702/2 kopfpilot] on the Plex forum.
Line 118: Line 134:


After applying the changes, just browse to <code>https://sub.domain.tld/web</code>. Of course use your actual (sub)domain name.
After applying the changes, just browse to <code>https://sub.domain.tld/web</code>. Of course use your actual (sub)domain name.
[[Category:Applications]]