1{
2 config,
3 lib,
4 ...
5}: let
6 name = "nitter";
7 cfg = config.myNixOS.services.${name};
8
9 network = config.mySnippets.tailnet;
10 service = network.networkMap.${name};
11in {
12 options.myNixOS.services.${name} = {
13 enable = lib.mkEnableOption "${name} server";
14 autoProxy = lib.mkOption {
15 default = true;
16 example = false;
17 description = "${name} auto proxy";
18 type = lib.types.bool;
19 };
20 };
21
22 config = lib.mkIf cfg.enable {
23 services = {
24 caddy.virtualHosts."${service.vHost}".extraConfig = lib.mkIf cfg.autoProxy ''
25 bind tailscale/${name}
26 encode zstd gzip
27 reverse_proxy ${service.hostName}:${toString service.port}
28 '';
29
30 nitter = {
31 enable = true;
32 openFirewall = true;
33 server = {
34 title = "twotter";
35 inherit (service) port;
36 hostname = "${config.mySnippets.tailnet.networkMap.redlib.vHost}";
37 };
38 preferences = {
39 theme = "Twitter";
40 squareAvatars = true;
41 replaceTwitter = "${service.vHost}";
42 replaceReddit = "${config.mySnippets.tailnet.networkMap.redlib.vHost}";
43 proxyVideos = false;
44 infiniteScroll = true;
45 hlsPlayback = true;
46 };
47 };
48 };
49 };
50}