about summary refs log tree commit diff
path: root/modules/endlessh-go.nix
blob: 5d3ddfebf71cc827f3992ba34a35bc616cf5fc8e (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
{
  config,
  lib,
  this,
  ...
}:
let
  cfg = config.nixfiles.modules.endlessh-go;
in
{
  options.nixfiles.modules.endlessh-go.enable = lib.mkEnableOption "endlessh-go";

  config =
    let
      port = 22;
    in
    lib.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