{ config, pkgs, lib, mkDomain, ... }:
{
  # Libreddit
  # Private front-end for Reddit

  services.libreddit = {
    enable = true;
    address = "127.0.0.1";
    port = 4876;
  };
  systemd.services.libreddit.environment = lib.mkIf config.services.libreddit.enable {
    # https://github.com/spikecodes/libreddit#change-default-settings=
    # TODO: merge my module addition
    LIBREDDIT_DEFAULT_THEME = "gold";
  };
  services.nginx.virtualHosts.${mkDomain "libreddit"} = lib.mkIf config.services.libreddit.enable {
    forceSSL = true; # addSSL = true;
    enableACME = true; #useACMEHost = acmeDomain;
    locations."/" = {
      proxyPass = "http://127.0.0.1:${toString config.services.libreddit.port}";
      proxyWebsockets = true;
    };
  };

}
