about summary refs log tree commit diff
path: root/machines/profpatsch/base-server.nix
blob: 921e5d8dc8941a4ef37d1f84475d7f0edb31a026 (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
34
35
36
{ config, pkgs, lib, ... }:

let
  cfg = config.vuizvui.user.profpatsch.server;

in
{
  imports = [
    ./base.nix
  ];

  options.vuizvui.user.profpatsch.server.sshPort = lib.mkOption {
    description = "ssh port";
    # TODO: replace with types.intBetween https://github.com/NixOS/nixpkgs/pull/27239
    type = with lib.types; addCheck int (x: x >= 0 && x <= 65535);
    default = 6879;
  };

  config = {

    programs.mosh.enable = true;

    services.openssh = {
      enable = true;
      listenAddresses = [ { addr = "0.0.0.0"; port = cfg.sshPort; } ];
    };

    networking.firewall = {
      enable = true;
      allowPing = true;
      allowedTCPPorts = [ cfg.sshPort ];
    };

  };

}