-
Notifications
You must be signed in to change notification settings - Fork 1
/
configuration.nix
216 lines (183 loc) · 4.91 KB
/
configuration.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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
{ config, lib, pkgs, modulesPath, ... }:
let
baseconfig = { allowUnfree = true; };
stable = import <nixpkgs> { config = baseconfig; };
unstable = import <nixpkgs-unstable> { config = baseconfig; };
comma = (import (pkgs.fetchFromGitHub {
owner = "nix-community";
repo = "comma";
rev = "v1.7.1";
sha256 = "sha256-x2HVm2vcEFHDrCQLIp5QzNsDARcbBfPdaIMLWVNfi4c=";
})).default;
in {
imports = [
./hardware-configuration.nix
(modulesPath + "/profiles/all-hardware.nix")
<nixos-hardware/common/pc/ssd>
<nixos-hardware/common/cpu/intel>
# Service configuration.
./o11y.nix
./tailscale.nix
./containers.nix
];
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
unstable.intel-compute-runtime
stable.intel-ocl
stable.intel-media-driver
stable.vaapiIntel
stable.vaapiVdpau
stable.libvdpau-va-gl
];
};
boot = {
# Use the systemd-boot EFI boot loader.
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
# Latest Linux kernel
kernelPackages = unstable.linuxPackages_latest;
kernelModules = [ "tcp_bbr" "kvm-intel" ];
kernel.sysctl."net.ipv4.tcp_congestion_control" = "bbr";
kernel.sysctl."net.core.default_qdisc" = "fq";
tmp.cleanOnBoot = true;
kernel.sysctl."net.ipv4.ip_forward" = 1;
kernel.sysctl."net.ipv6.conf.all.forwarding" = 1;
};
networking = {
hostName = "servnerr";
nameservers = [ "1.1.1.1" "2606:4700:4700::1111" ];
useDHCP = false;
interfaces.eno1.useDHCP = true;
timeServers = [ "time.nrc.ca" "time.chu.nrc.ca" "time.google.com" ];
firewall = {
enable = true;
checkReversePath = "loose";
trustedInterfaces = [ "tailscale0" "eno1" ];
allowedUDPPorts = [ 443 config.services.tailscale.port 51413 4001 ];
allowedTCPPorts = [ 22 53 80 443 51413 4001 8080];
};
};
time.timeZone = "America/Vancouver";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.adi = {
isNormalUser = true;
extraGroups =
[ "wheel" "sudo" "oci" "docker" "root" ]; # Enable ‘sudo’ for the user.
shell = pkgs.zsh;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE/Cr+bIMxMzkk8dN7xxRsaJeHRifwlyTuh/ja9Uy9MN"
];
};
nix = {
# Automatic Nix GC.
gc = {
automatic = true;
dates = "04:00";
options = "--delete-older-than 7d";
};
extraOptions = ''
min-free = ${toString (500 * 1024 * 1024)}
'';
settings = {
trusted-users = [ "root" "adi" ];
# Automatic store optimization.
auto-optimise-store = true;
};
};
system = {
# Automatic upgrades.
autoUpgrade.enable = true;
autoUpgrade.allowReboot = true;
stateVersion = "23.05";
};
environment = {
# Put ~/bin in PATH.
homeBinInPath = true;
# Packages which should be installed on every machine.
systemPackages = with pkgs; [
comma
unstable.direnv
unstable.git
unstable.go
unstable.clinfo
unstable.lshw
unstable.htop
unstable.iftop
unstable.iotop
unstable.intel-gpu-tools
unstable.neofetch
unstable.nixfmt
unstable.ripgrep
unstable.starship
unstable.tailscale
unstable.wget
unstable.zsh
];
};
# Enable firmware updates when possible.
hardware.enableRedistributableFirmware = true;
# Enable Chrony
services.chrony.enable = true;
services.chrony.package = unstable.chrony;
services.chrony.extraConfig = ''
makestep 1.0 10
hwtimestamp *
rtcsync
'';
# Enable the OpenSSH daemon.
services.openssh.enable = true;
programs.mosh = { enable = true; };
# fstrim
services.fstrim = { enable = true; };
# fwupd
services.fwupd = {
package = unstable.fwupd;
enable = true;
};
security.sudo.wheelNeedsPassword = false;
virtualisation.docker = {
enable = true;
package = unstable.docker;
daemon.settings = {
experimental = true;
ipv6 = true;
fixed-cidr-v6 = "2001:db8:1::/64";
ip6tables = true;
registry-mirrors = [ "https://mirror.gcr.io" ];
};
};
services.nfs.server.enable = true;
services.nfs.server.exports = ''
/persist *(rw,fsid=root,no_subtree_check)
'';
services.nfs.server.hostName = "100.122.68.5";
systemd.services.nfs-server = {
after = [ "tailscaled.service" ];
};
programs.starship = {
enable = true;
settings = {
add_newline = true;
format = "$all";
};
};
programs.zsh = {
enable = true;
enableCompletion = true;
enableBashCompletion = true;
enableGlobalCompInit = true;
syntaxHighlighting.enable = true;
autosuggestions.enable = true;
interactiveShellInit = ''
eval "$(direnv hook zsh)"
'';
};
}