Title: How to host a local front-end for Reddit / YouTube / Twitter on | |
NixOS | |
Author: Solène | |
Date: 02 September 2022 | |
Tags: nixos privacy | |
Description: This article explains how to use NixOS to host a local | |
front-end for services like YouTube, Twitter or Reddit. | |
# Introduction | |
I'm not a consumer of proprietary social networks, but sometimes I have | |
to access content hosted there, and in that case I prefer to use a | |
front-end reimplementation of the service. | |
These front-ends are network services that acts as a proxy to the | |
proprietary service, and offer a different interface (usually cleaner) | |
and also remove tracking / ads. | |
In your web browser, you can use the extension Privacy Redirect to | |
automatically be redirected to such front-ends. But even better, you | |
can host them locally instead of using public instances that may be | |
unresponsive, on NixOS it's super easy. | |
We are going to see how to deploy them on NixOS. | |
Privacy Redirect GitHub project page | |
libreddit GitHub project page: Reddit front-end | |
Invidious project website: YouTube front-end | |
nitter GitHub project page: Twitter front-end | |
# Deployment | |
As September 2022, libreddit, invidious and nitter have NixOS modules | |
to manage them. | |
The following pieces of code can be used in your NixOS configuration | |
file (/etc/nixos/configuration.nix as the default location) before | |
running "nixos-rebuild" to use the newer configuration. | |
I focus on running the services locally and not expose them on the | |
network, thus you will need a bit more configuration to add HTTPS and | |
tune the performance if you need more users. | |
## Libreddit | |
We will use the container and run it with podman, a docker alternative. | |
The service takes only a few megabytes to run. | |
The service is exposed on http://127.0.0.1:12344 | |
``` | |
services.libreddit = { | |
address = "127.0.0.1"; | |
port = 12344; | |
}; | |
``` | |
## Invidious | |
This is using the NixOS module. | |
The service is exposed on http://127.0.0.1:12345 | |
```nix | |
services.invidious = { | |
enable = true; | |
nginx.enable = false; | |
port = 12345; | |
# if you want to disable recommended videos | |
settings = { | |
default_user_preferences = { | |
"related_videos" = false; | |
}; | |
}; | |
}; | |
``` | |
## Nitter | |
This is using the NixOS module. | |
The service is exposed on http://127.0.0.1:12346 | |
``` | |
services.nitter = { | |
enable = true; | |
server.port = 12346; | |
server.address = "127.0.0.1"; | |
}; | |
``` | |
# Privacy redirect | |
By default, the extension will pick a random public instance, you can | |
configure it per service to use your local instance. | |
# Conclusion | |
I very enjoy these front-ends, they draw a lot less resources when | |
browsing these websites. I prefer to run them locally for performance | |
reasons. | |
If you run such instances on your local computer, this doesn't help | |
with regard to privacy. If you care about privacy, you should use | |
public instances, or host your own public instances so many different | |
users are behind the same service and this makes profiling harder. But | |
if you want to host such instance, you may need to tweak the | |
performance, and add a reverse proxy and a valid TLS certificate. |