2022-03-11 14:53:51 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2021-09-08 18:23:21 +02:00
|
|
|
let
|
|
|
|
cfg = config.services.nitter;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
services.nitter = {
|
|
|
|
enable = true;
|
2022-05-31 14:35:00 +02:00
|
|
|
#package = pkgs.unstable.nitter;
|
2021-09-08 18:23:21 +02:00
|
|
|
server = {
|
|
|
|
port = 8081;
|
|
|
|
hostname = "nitter.sbruder.xyz";
|
|
|
|
address = "127.0.0.1";
|
|
|
|
};
|
|
|
|
preferences = {
|
|
|
|
theme = "Auto";
|
|
|
|
replaceTwitter = "${cfg.server.hostname}";
|
|
|
|
muteVideos = true;
|
|
|
|
hlsPlayback = true;
|
|
|
|
replaceYouTube = "${config.services.invidious.domain}";
|
|
|
|
};
|
2023-05-06 10:54:03 +02:00
|
|
|
config = {
|
|
|
|
base64Media = true;
|
|
|
|
};
|
2021-09-08 18:23:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts.${cfg.server.hostname} = {
|
2023-05-06 10:54:03 +02:00
|
|
|
extraConfig = ''
|
|
|
|
allow ${config.sbruder.wireguard.home.subnet};
|
|
|
|
deny all;
|
|
|
|
'';
|
2021-09-08 18:23:21 +02:00
|
|
|
locations = {
|
|
|
|
"/robots.txt".return = "200 'User-agent: *\\nDisallow: /'";
|
|
|
|
"/" = {
|
|
|
|
proxyPass = "http://${cfg.server.address}:${toString cfg.server.port}";
|
|
|
|
extraConfig =
|
|
|
|
let
|
|
|
|
# workaround for nginx dropping parent headers
|
|
|
|
# see https://github.com/yandex/gixy/blob/master/docs/en/plugins/addheaderredefinition.md
|
|
|
|
parentHeaders = lib.concatStringsSep "\n" (lib.filter
|
|
|
|
(lib.hasPrefix "add_header ")
|
|
|
|
(lib.splitString "\n" config.services.nginx.commonHttpConfig));
|
|
|
|
in
|
|
|
|
''
|
|
|
|
${parentHeaders}
|
2021-11-21 21:09:25 +01:00
|
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' blob:; style-src 'self' 'unsafe-inline'; media-src 'self' blob:";
|
2021-09-08 18:23:21 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|