-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.nix
321 lines (290 loc) · 6.7 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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
{
pkgs,
user,
otherHosts,
inputs,
...
}:
{
imports = [ (./. + "/hardware/${user.host}" + "/hardware-configuration.nix") ];
nixpkgs.config = {
allowUnfree = true;
};
nix = {
package = pkgs.nixVersions.stable;
nixPath = [
"nixpkgs=${inputs.nixpkgs}"
"nixos-config=${/home/common/SConfig/nixos-config/configuration.nix}"
];
registry = {
nixpkgs = {
flake = inputs.nixpkgs;
};
master = {
flake = inputs.nixpkgs-master;
};
};
gc = {
automatic = true;
options = "--delete-older-than 7d";
};
settings = {
auto-optimise-store = true;
extra-substituters = [
"https://nix-community.cachix.org"
"https://cache.iog.io"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];
};
#cache environments for nix-direnv
extraOptions = ''
keep-outputs = true
keep-derivations = true
experimental-features = nix-command flakes
access-tokens = github.com=${user.ghk}
'';
};
boot.loader =
if user.efiBoot then
{
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot${user.bootMountpoint}";
};
grub = {
enable = true;
devices = [ "nodev" ];
efiSupport = true;
useOSProber = true;
};
}
else
{
grub = {
enable = true;
device = user.mbrDevice;
};
};
time.timeZone = "Europe/Paris";
i18n.defaultLocale = "en_US.UTF-8";
networking.hostName = user.host;
networking.useDHCP = false;
networking.networkmanager.enable = true;
networking.extraHosts =
if user.isWorkComputer then
let
readIfExists = x: if builtins.pathExists x then builtins.readFile x else "";
joinFiles = x: builtins.concatStringsSep "\n" (map readIfExists x);
in
''
${joinFiles [
/home/vhs/Public/extraHosts
/home/office/Public/extraHosts
]}
''
else
"";
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
services.libinput = {
enable = true;
mouse.accelSpeed = "1.5";
};
services.xserver = {
enable = true;
autoRepeatDelay = 200;
autoRepeatInterval = 30;
exportConfiguration = true;
desktopManager = {
xterm.enable = false;
wallpaper = {
mode = "max";
combineScreens = false;
};
};
xkb.layout = "us";
xkb.variant = "altgr-intl";
# nvidia driver in hardware file
videoDrivers = if user.nvidia || user.amd then [ "" ] else [ "intel" ];
deviceSection = ''
Option "TearFree" "true"
'';
};
services.xserver.displayManager.gdm.enable = true;
services.xserver.windowManager.icewm.enable = true;
services.picom = {
enable = if user.usei3 then true else false;
vSync = true;
inactiveOpacity = 0.96;
fade = true;
fadeDelta = 8;
fadeSteps = [
2.8e-2
3.0e-2
];
};
programs.nm-applet.enable = if user.usei3 then true else false;
programs.sway.enable = if user.usei3 then false else true;
hardware.graphics.enable = true;
hardware.pulseaudio.enable = false;
hardware.bluetooth.enable = true;
hardware.bluetooth.settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
Policy = {
AutoEnable = false;
};
};
services.blueman.enable = true;
services.pipewire = {
enable = true;
pulse.enable = true;
wireplumber.enable = true;
};
users = {
users.vhs = {
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [
"wheel"
"docker"
"adbusers"
"libvirtd"
"qemu-libvirtd"
"syncthing"
"networkmanager"
"ops"
];
};
users.office = {
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [
"wheel"
"docker"
"networkmanager"
"syncthing"
"ops"
];
};
groups.ops.members = [
"vhs"
"office"
];
extraGroups.vboxusers.members = [ "vhs" ];
};
networking.firewall.allowedTCPPorts = [
9000
3000
3307
8080
];
networking.firewall.checkReversePath = false;
environment.pathsToLink = [ "/share/zsh" ];
environment.systemPackages = with pkgs; [
(python3.withPackages (p: [
p.pynvim
p.virtualenv
]))
zsh
wget
curl
vim
firefox
lm_sensors
vlc
gnupg
htop
jq
docker
pavucontrol
nmap
neovim
xfce.xfce4-terminal
xclip
blueman
x11_ssh_askpass
nodejs_22
sysstat
docker-compose
wireguard-tools
git-crypt
inputs.basmati.packages.${pkgs.system}.default
];
programs.ssh.askPassword = "${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass";
programs.ssh.startAgent = true;
programs.ssh.extraConfig = "AddKeysToAgent = yes";
programs.zsh.enable = true;
programs.dconf.enable = true;
programs.gnupg.agent = {
enable = true;
};
programs.adb.enable = true;
services.openssh.enable = user.enableSSH;
systemd.extraConfig = ''
DefaultTimeoutStopSec=10s
DefaultDeviceTimeoutSec=10s
TimeoutSec=10s
'';
systemd.watchdog.runtimeTime = "20s";
# systemd.additionalUpstreamSystemUnits = [ "debug-shell.service" ];
services.syncthing = {
enable = true;
openDefaultPorts = true;
dataDir = "/home/vhs/Sync";
configDir = "/home/vhs/.syncthing";
guiAddress = "localhost:3331";
user = "vhs";
group = "ops";
settings = {
devices = {
mpu3 = {
id = "5XO7ZS3-U7ZD452-Z7U5QI7-K2STPKM-QL7WZBU-GHBHBQR-HR6L57P-32N2VQX";
};
mpu4 = {
id = "MXC4OD2-VXLPIH6-3FGQRL7-AW2YTLZ-FAYEACI-IGXSX5M-DWAUKRH-KSZVFA3";
};
mbison = {
id = "3MOHUU5-GYFZ3WD-O6VI3ZX-RWSBMFP-ZTMKNQ6-5VTXMT3-FVZ377Y-SOPNTQV";
};
mbebe = {
id = "WBPCZ3R-A32TI6D-OR4XP34-2OFBY2J-O2GGES3-Q36MKQ6-E7TBA22-37SPUQW";
};
};
folders = {
"/home/vhs/Sync" = {
id = "sync";
devices = [
"mbison"
"mpu3"
"mpu4"
"mbebe"
];
};
"/home/common/Folder" = {
id = "folder";
devices = [
"mbison"
"mpu3"
"mpu4"
"mbebe"
];
};
};
};
};
services.fwupd.enable = false;
#scheduling process used by pulseaudio
security.rtkit.enable = true;
security.sudo.wheelNeedsPassword = false;
security.polkit = {
enable = true;
};
system.stateVersion = "20.09";
}