nixos-config/machines/renge/services/nitter.nix
Simon Bruder 37f0d3e1fc
Remove settings no longer necessary
Swaync is in stable, mumble 1.4 is in stable and has pulseaudio enabled
by default, the tray target is defined in home-manager upstream and
nix-direnv comes with flake support by default.
2022-05-31 15:04:52 +02:00

46 lines
1.4 KiB
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.services.nitter;
in
{
services.nitter = {
enable = true;
#package = pkgs.unstable.nitter;
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}";
};
};
services.nginx.virtualHosts.${cfg.server.hostname} = {
forceSSL = true;
enableACME = true;
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}
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' blob:; style-src 'self' 'unsafe-inline'; media-src 'self' blob:";
'';
};
};
};
}