Profpatsch/machines/profpatsch/base-server.nix
 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
{ config, pkgs, lib, authKeys, ... }:

{
  imports = [ ./base.nix ];

  config = {
    programs.mosh.enable = true;

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

    networking.enableIPv6 = false;

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

    # Use a stable nixpkgs for ad-hoc nix-shell on servers
    nix.nixPath = [
      "nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz"
    ];
    nix.settings.auto-optimise-store = true;
    nix.settings.min-free = 3 * 1024 * 1024 * 1024;

    users.users.root.openssh.authorizedKeys.keys = authKeys;
  };
}