aboutsummaryrefslogtreecommitdiff
path: root/profiles/defaults.nix
blob: 8396599cd6fb6036a077ae4b0e35027fe4831c28 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{
  self,
  config,
  pkgs,
  lib,
  ...
}:
{
  boot = {
    kernelPackages = pkgs.linuxPackages_latest;
    plymouth.enable = true;
    kernelParams = [
      "quiet"
      "splash"
      "rd.systemd.show_status=false"
      "boot.shell_on_fail"
    ];
    kernel.sysctl = {
      "net.ipv4.tcp_congestion_control" = "bbr";
      "net.ipv4.tcp_ecn" = 1;
      "net.ipv4.tcp_fastopen" = 3;
      "net.ipv4.tcp_tw_reuse" = 1;
    };
  };

  console = {
    earlySetup = true;
    font = "ter-132n";
    packages = with pkgs; [ terminus_font ];
    keyMap = "us";
  };

  nix = {
    gc = {
      automatic = true;
      options = "--delete-older-than 14d";
    };

    optimise.automatic = true;

    extraOptions = ''
      tarball-ttl = 900
    '';

    package = pkgs.nixVersions.stable;

    settings = {
      trusted-substituters = [
        "https://cachix.cachix.org"
        "https://nixpkgs.cachix.org"
        "https://nix-community.cachix.org"
      ];
      trusted-public-keys = [
        "cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM="
        "nixpkgs.cachix.org-1:q91R6hxbwFvDqTSDKwDAV4T5PxqXGxswD8vhONFMeOE="
        "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
        "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      ];
      trusted-users = [ "root" ];
      experimental-features = lib.mkDefault [
        "nix-command"
        "flakes"
      ];
    };
  };

  networking = {
    useNetworkd = true;
    # Used by systemd-resolved, not directly by resolv.conf.
    nameservers = [
      "8.8.8.8#dns.google"
      "1.0.0.1#cloudflare-dns.com"
    ];
    firewall = {
      enable = true;
      allowPing = true;
      logRefusedConnections = false;
    };
  };

  systemd.network = {
    enable = true;
  };

  services.resolved = {
    enable = true;
    dnssec = "false";
  };

  i18n = {
    defaultLocale = "en_US.UTF-8";
    supportedLocales = [
      "en_US.UTF-8/UTF-8"
    ];
  };

  time.timeZone = "America/Los_Angeles";

  users.motdFile = "/etc/motd";

  environment.etc.motd.text = ''
    Machine  ${config.networking.hostName}
     NixOS   ${config.system.nixos.release}
       @     ${self.shortRev or self.dirtyShortRev}
  '';

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

  users = {
    mutableUsers = false;
    users.root.openssh.authorizedKeys.keys = [
      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBkozy+X96u5ciX766bJ/AyQ3xm1tXZTIr5+4PVFZFi"
    ];
  };

  security.sudo.wheelNeedsPassword = false;

  environment.systemPackages = with pkgs; [
    bottom
    curl
    dysk
    fd
    fish
    git
    htop
    jq
    kitty.terminfo
    mtr
    pciutils
    powertop
    ripgrep
    tcpdump
    traceroute
    vim
    wireguard-tools
  ];
}