summaryrefslogtreecommitdiff
path: root/content/theses/self-sufficiency/media.md
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--content/theses/self-sufficiency/media.md105
1 files changed, 105 insertions, 0 deletions
diff --git a/content/theses/self-sufficiency/media.md b/content/theses/self-sufficiency/media.md
new file mode 100644
index 0000000..a55fa00
--- /dev/null
+++ b/content/theses/self-sufficiency/media.md
@@ -0,0 +1,105 @@
+---
+title: media
+weight: 20
+---
+
+Movies, shows, and music tend to fall under the broad category of "media". This means that there exist solutions to self-host an entire suite for all "media", so there is no need to pay seperate subscriptions to services such as Netflix and/or Spotify.
+
+{{% hint info %}}
+Self-hosted means BYOM (Bring Your Own Media).
+This will not buy you movies/tv shows/music.
+On a discussion on the subject, [read this article](https://wiki.futo.org/index.php/Introduction_to_a_Self_Managed_Life:_a_13_hour_%26_28_minute_presentation_by_FUTO_software#%E2%80%9CPiracy%E2%80%9D)
+I am not taking any ethical stance on piracy; I am taking an ethical stance on ownership.
+{{% /hint %}}
+
+We will be using Jellyfin, which is a free and open-source software for serving media libraries, effectively replacing Netflix (albeit with a clankier UI) and spotify, with dedicated third-party clients.
+
+## specs
+Whilst serving videos, the server needs to parse the bits; the higher the resolution, the higher the useage.
+
+When idling, jellyfin takes 273M of RAM on my system.
+
+## installation
+
+Create a `jellyfin` folder and a `default.nix` file inside it, at the place where you have the rest of your nixos configuration
+```sh
+$ mkdir jellyfin && touch jellyfin/default.nix
+```
+(or use the file explorer of your choice)
+
+### nix declaration
+
+Open `jellyfin/default.nix` in any text editor, and copy the following
+
+```nix
+{ config, pkgs, lib, ...}:
+{
+ environment.systemPackages = with pkgs; [
+ jellyfin
+ jellyfin-web
+ jellyfin-ffmpeg
+ logrotate
+ ];
+
+ services = {
+ jellyfin = {
+ enable = true;
+ };
+
+ logrotate.enable = true;
+
+ nginx = {
+ virtualHosts."media.<YOUR-DOMAIN" = {
+ enableACME = true;
+ forceSSL = true;
+
+ locations."/" = {
+ proxyPass = "http://127.0.0.1:8096";
+ proxyWebsockets = true;
+ };
+ };
+ };
+ };
+}
+```
+
+Then to enable it, just include it in the server config file:
+```nix
+ imports = [
+ # ... other services
+ ./jellyfin
+ # ... other services
+ ];
+```
+and you're done.
+
+Let's break the config file down.
+
+### explanation
+1) First, we declare the packages that we will use. We install them as systemPackages, because jellyfin is packaged in a weird manner.
+2) Then, we declare the `jellyfin` service as enabled.
+3) We enable logrotate, which helps clean logs and keeps them in a manageable size (otherwise jellyfin tends to fill the logs and bloat the system).
+4) We set up nginx to set up a reverse proxy at `media.<YOUR-DOMAIN>`, so that jellyfin is only acessible via the reverse proxy.
+
+{{% hint info %}}
+The nix service of Jellyfin doesn't allow us to customize the port, so the default one (`8096`) has to be used.
+{{% /hint %}}
+
+{{% hint info %}}
+More information can be found at the [wiki](https://wiki.nixos.org/wiki/jellyfin), but it can be opaque. Specifically it has info concerning mounting external drives (from a NAS potentially), which is not covered here.
+More options can be found [here](https://mynixos.com/nixpkgs/options/services.jellyfin).
+{{% /hint %}}
+### further setup
+Once the service is up and running, go to `localhost:8096`, or `media.<YOUR-DOMAIN>`, or whatever domain you set it to.
+
+You must set up an administrator account. This can either be a completely seperate account to your own, or it could be your own account.
+
+You must also point and set up the different libraries (and types of libraries) you want to host, like Movies/TV Shows/Music, etc. You can have multiple of each type. I have three for Music, two for TV Shows, and one for Movies, because I share this instance with other family members.
+
+{{% hint info %}}
+Playlists are public in each library. You might want to make a Music library per user.
+{{% /hint %}}
+
+
+## service backups
+Jellyfin simply serves media files, and fetches and displays metadata from within the media folders you provide. Just keep a backup of those folders. To keep a copy of the exact jellyfin setup and configuration you may do on top of the nix service, just keep a copy of `/var/lib/jellyfin`.
Directive (EU) 2019/790, Article 4(3); all rights regarding Text and Data Mining (TDM) are reserved.