summaryrefslogtreecommitdiff
path: root/modules/nixos/endlessh-go.nix
blob: efaaa8f30193d82ad9b60e4f0f6bd9c9cbc42dde (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
33
34
35
36
{
  config,
  lib,
  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 ];
    };
}