about summary refs log tree commit diff
path: root/modules/nixos/endlessh-go.nix
blob: 435305dc3eac5612e074289abc7c264189cb0224 (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
{
  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];
    };
}

Consider giving Nix/NixOS a try! <3