-
Notifications
You must be signed in to change notification settings - Fork 119
/
default.nix
333 lines (289 loc) · 8.56 KB
/
default.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
322
323
324
325
326
327
328
329
330
331
332
333
{ config, inputs, lib, pkgs, agenix, ... }:
let user = "dustin";
keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOk8iAnIaa1deoc7jw8YACPNVka1ZFJxhnU4G74TmS+p" ]; in
{
imports = [
../../modules/nixos/secrets.nix
../../modules/nixos/disk-config.nix
../../modules/shared
agenix.nixosModules.default
];
# Use the systemd-boot EFI boot loader.
boot = {
loader = {
systemd-boot = {
enable = true;
configurationLimit = 42;
};
efi.canTouchEfiVariables = true;
};
initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "v4l2loopback" ];
kernelModules = [ "uinput" "v4l2loopback" ];
extraModulePackages = [ pkgs.linuxPackages.v4l2loopback ];
};
# Set your time zone.
time.timeZone = "America/New_York";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking = {
hostName = "felix"; # Define your hostname.
useDHCP = false;
interfaces.eno1.useDHCP = true;
};
# Turn on flag for proprietary software
nix = {
nixPath = [ "nixos-config=/home/${user}/.local/share/src/nixos-config:/etc/nixos" ];
settings = {
allowed-users = [ "${user}" ];
trusted-users = [ "@admin" "${user}" ];
substituters = [ "https://nix-community.cachix.org" "https://cache.nixos.org" ];
trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ];
};
package = pkgs.nix;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
# Manages keys and such
programs = {
gnupg.agent.enable = true;
# Needed for anything GTK related
dconf.enable = true;
# My shell
zsh.enable = true;
};
services = {
xserver = {
enable = true;
videoDrivers = [ "nvidia" ];
# This helps fix tearing of windows for Nvidia cards
screenSection = ''
Option "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
Option "AllowIndirectGLXProtocol" "off"
Option "TripleBuffer" "on"
'';
# LightDM Display Manager
displayManager.defaultSession = "none+bspwm";
displayManager.lightdm = {
enable = true;
greeters.slick.enable = true;
background = ../../modules/nixos/config/login-wallpaper.png;
};
# Tiling window manager
windowManager.bspwm = {
enable = true;
};
# Better support for general peripherals
libinput.enable = true;
# Turn Caps Lock into Ctrl
xkb = {
layout = "us";
options = "ctrl:nocaps";
};
};
# Enable CUPS to print documents
printing = {
enable = true;
drivers = [ pkgs.brlaser ]; # Brother printer driver
};
syncthing = {
enable = true;
openDefaultPorts = true;
dataDir = "/home/${user}/.local/share/syncthing";
configDir = "/home/${user}/.config/syncthing";
user = "${user}";
group = "users";
guiAddress = "127.0.0.1:8384";
overrideFolders = true;
overrideDevices = true;
settings = {
devices = {
"Macbook Pro" = {
id = "P2FYLQW-PKDFJGZ-EUGI2T7-OW4AH4I-KI462HD-U2VL3X3-GN55PP2-VNRE5AH";
autoAcceptFolders = true;
allowedNetwork = "192.168.0.0/16";
addresses = [ "tcp://192.168.0.99:51820" ];
};
"Home Lab" = {
id = "WW5O366-THBBBA3-HKQAYCP-EWADS4I-4KDDC5Z-3JCO42M-RLBZ3DY-NM7PEQA";
allowedNetwork = "192.168.0.0/16";
autoAcceptFolders = true;
addresses = [ "tcp://192.168.0.103:51820" ];
};
};
folders = {
"XDG Share" = {
id = "ukrub-quh7k";
path = "/home/${user}/.local/share";
devices = [ "Macbook Pro" "Home Lab" ];
};
};
options.globalAnnounceEnabled = false; # Only sync on LAN
};
};
# Picom, my window compositor with fancy effects
#
# Notes on writing exclude rules:
#
# class_g looks up index 1 in WM_CLASS value for an application
# class_i looks up index 0
#
# To find the value for a specific application, use `xprop` at the
# terminal and then click on a window of the application in question
#
picom = {
enable = true;
settings = {
animations = true;
animation-stiffness = 300.0;
animation-dampening = 35.0;
animation-clamping = false;
animation-mass = 1;
animation-for-workspace-switch-in = "auto";
animation-for-workspace-switch-out = "auto";
animation-for-open-window = "slide-down";
animation-for-menu-window = "none";
animation-for-transient-window = "slide-down";
corner-radius = 12;
rounded-corners-exclude = [
"class_i = 'polybar'"
"class_g = 'i3lock'"
];
round-borders = 3;
round-borders-exclude = [];
round-borders-rule = [];
shadow = true;
shadow-radius = 8;
shadow-opacity = 0.4;
shadow-offset-x = -8;
shadow-offset-y = -8;
fading = false;
inactive-opacity = 0.8;
frame-opacity = 0.7;
inactive-opacity-override = false;
active-opacity = 1.0;
focus-exclude = [
];
opacity-rule = [
"100:class_g = 'i3lock'"
"60:class_g = 'Dunst'"
"100:class_g = 'Alacritty' && focused"
"90:class_g = 'Alacritty' && !focused"
];
blur-kern = "3x3box";
blur = {
method = "kernel";
strength = 8;
background = false;
background-frame = false;
background-fixed = false;
kern = "3x3box";
};
shadow-exclude = [
"class_g = 'Dunst'"
];
blur-background-exclude = [
"class_g = 'Dunst'"
];
backend = "glx";
vsync = false;
mark-wmwin-focused = true;
mark-ovredir-focused = true;
detect-rounded-corners = true;
detect-client-opacity = false;
detect-transient = true;
detect-client-leader = true;
use-damage = true;
log-level = "info";
wintypes = {
normal = { fade = true; shadow = false; };
tooltip = { fade = true; shadow = false; opacity = 0.75; focus = true; full-shadow = false; };
dock = { shadow = false; };
dnd = { shadow = false; };
popup_menu = { opacity = 1.0; };
dropdown_menu = { opacity = 1.0; };
};
};
};
# Let's be able to SSH into this machine
openssh.enable = true;
# My editor runs as a daemon
emacs = {
enable = true;
package = pkgs.emacs-unstable;
};
gvfs.enable = true; # Mount, trash, and other functionalities
tumbler.enable = true; # Thumbnail support for images
};
systemd.user.services.emacs = {
serviceConfig.TimeoutStartSec = "7min";
};
# Enable sound
sound.enable = true;
hardware = {
pulseaudio.enable = true;
# Video support
opengl = {
enable = true;
driSupport32Bit = true;
driSupport = true;
};
nvidia.modesetting.enable = true;
# Crypto wallet support
ledger.enable = true;
};
# Sync state between machines
# Add docker daemon
virtualisation = {
docker = {
enable = true;
logDriver = "json-file";
};
};
# It's me, it's you, it's everyone
users.users = {
${user} = {
isNormalUser = true;
extraGroups = [
"wheel" # Enable ‘sudo’ for the user.
"docker"
];
shell = pkgs.zsh;
openssh.authorizedKeys.keys = keys;
};
root = {
openssh.authorizedKeys.keys = keys;
};
};
# Don't require password for users in `wheel` group for these commands
security.sudo = {
enable = true;
extraRules = [{
commands = [
{
command = "${pkgs.systemd}/bin/reboot";
options = [ "NOPASSWD" ];
}
];
groups = [ "wheel" ];
}];
};
fonts.packages = with pkgs; [
dejavu_fonts
emacs-all-the-icons-fonts
feather-font # from overlay
jetbrains-mono
font-awesome
noto-fonts
noto-fonts-emoji
];
environment.systemPackages = with pkgs; [
agenix.packages."${pkgs.system}".default # "x86_64-linux"
gitAndTools.gitFull
linuxPackages.v4l2loopback
v4l-utils
inetutils
];
system.stateVersion = "21.05"; # Don't change this
}