aboutsummaryrefslogtreecommitdiff
path: root/nix/profiles/server.nix
blob: 15883144e236e6cf2bceb08008edd013a3f99dd4 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
  config,
  lib,
  pkgs,
  ...
}:
{

  imports = [
    ./nix.nix
  ];

  time.timeZone = "America/Los_Angeles";

  # Don't require password for sudo
  security.sudo.wheelNeedsPassword = false;

  # Virtualization settings
  virtualisation.docker.enable = true;

  # Select internationalisation properties.
  i18n = {
    defaultLocale = "en_US.UTF-8";
  };

  boot.loader.systemd-boot.enable = true;
  boot.kernelPackages = pkgs.linuxPackages_latest;

  environment.systemPackages = with pkgs; [
    curl
    fd
    fish
    git
    htop
    jq
    mtr
    pciutils
    powertop
    ripgrep
    tcpdump
    traceroute
    vim
  ];

  boot.kernel.sysctl = {
    "net.ipv4.tcp_fastopen" = 3;
    "net.ipv4.tcp_tw_reuse" = 1;
  };

  networking = {
    firewall = {
      enable = false;
      allowPing = true;
      logRefusedConnections = false;
    };
    useNetworkd = lib.mkDefault true;
  };

  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  networking.useDHCP = lib.mkDefault true;

  # Default to systemd-networkd usage.
  systemd.network.wait-online.anyInterface = lib.mkDefault config.networking.useDHCP;

  # Use systemd-resolved for DoT support.
  services.resolved = {
    enable = true;
    dnssec = "false";
    extraConfig = ''
      DNSOverTLS=yes
    '';
  };

  # Used by systemd-resolved, not directly by resolv.conf.
  networking.nameservers = [
    "8.8.8.8#dns.google"
    "1.0.0.1#cloudflare-dns.com"
  ];

  ## disable that slow "building man-cache" step
  documentation.man.generateCaches = lib.mkForce false;
}