about summary refs log tree commit diff
path: root/modules/endlessh-go.nix
blob: 2919534cacf90f9dc54649914af10699d1784a14 (plain) (blame)
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
{
  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" ];
      };

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

Consider giving Nix/NixOS a try! <3