summaryrefslogtreecommitdiff
path: root/modules/nixfiles/endlessh-go.nix
blob: 9ceb4e426965e12ed0a04f6af31af83f79159d0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
  config,
  inputs,
  lib,
  pkgs,
  this,
  ...
}:
with lib; let
  cfg = config.nixfiles.modules.endlessh-go;
in {
  options.nixfiles.modules.endlessh-go.enable = mkEnableOption "endlessh-go";

  config = let
    port = 22;
  in
    mkIf cfg.enable {
      services.endlessh-go = {
        enable = true;
        listenAddress = "0.0.0.0";
        inherit port;
        prometheus = {
          enable = true;
          listenAddress = this.wireguard.ipv4.address;
          port = 9229;
        };
        extraOptions = ["-geoip_supplier=ip-api" "-v=1"];
      };

      networking.firewall.allowedTCPPorts = [port];
    };
}