-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.nix
285 lines (265 loc) · 7.48 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
# vim: set expandtab tabstop=2 softtabstop=2 shiftwidth=2 autoindent:
{ config, pkgs, lib, ... }:
{
imports = [
./hardware-configuration.nix
];
# Enable OpenCL on Intel. Maybe move to platform-specific include?
hardware.opengl.extraPackages = with pkgs; [vaapiIntel libvdpau-va-gl vaapiVdpau intel-ocl];
nixpkgs.config = {
packageOverrides = (pkgs: rec {
inherit pkgs;
protovim = pkgs.callPackage ./packages/protovim.nix {};
});
allowUnfree = true;
};
nix = {
nixPath = [
"nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs"
"nixos-config=/etc/nixos/configuration.nix"
"/nix/var/nix/profiles/per-user/root/channels"
];
useSandbox = true;
autoOptimiseStore = true;
trustedUsers = [ "root" "hamlinb" ];
buildCores = 0; # Use all cores for builds
};
boot = {
loader.grub = {
enable = true;
version = 2;
device = "/dev/sda";
};
# Use LUKS-encrypted LVM root
initrd.luks.devices = [
{
name = "root";
device = "/dev/sda3";
preLVM = true;
}
];
kernelParams = [
# The arch-wiki thinks this might fix the xorg freezes:
# https://wiki.archlinux.org/index.php/intel_graphics#X_freeze.2Fcrash_with_intel_driver
"intel_idle.max_cstate=1"
"i915.enable_rc6=0"
];
blacklistedKernelModules = [
"uvcvideo" # Remove and reboot on the off chance that we ever want the webcam
];
extraModulePackages = [ pkgs.linuxPackages.rtl8812au ];
enableContainers = true;
};
# Avoids FS corruption on SSDs (http://github.com/NixOS/nixpkgs/issues/11276)
powerManagement.scsiLinkPolicy = "max_performance";
i18n = {
consoleFont = "Lat2-Terminus16";
consoleKeyMap = "us";
defaultLocale = "en_US.UTF-8";
};
time.timeZone = "America/Los_Angeles";
environment = {
systemPackages = with pkgs; [
man-pages
file
lsof
acpi
dunst
git
gnumake
libnotify
pkgconfig
nvi
];
variables = {
BROWSER = "w3m";
# Less Colors for Man Pages
LESS_TERMCAP_mb = "\\[$(tput setaf 208)\\]"; # begin blinking
LESS_TERMCAP_md = "\\[$(tput bold; tput setaf 140)\\]"; # begin bold
LESS_TERMCAP_me = "\\[$(tput sgr0)\\]"; # end mode
LESS_TERMCAP_se = "\\[$(tput sgr0)\\]"; # end standout-mode
LESS_TERMCAP_so = "\\[$(tput smso; tput setaf 50)\\]"; # begin standout-mode - info box
LESS_TERMCAP_ue = "\\[$(tput rmul)\\]"; # end underline
LESS_TERMCAP_us = "\\[$(tput smul; tput setaf 198)\\]"; # begin underline
};
shellAliases = {
ssh = "TERM=xterm-256color ssh";
ls = "ls --color=tty";
};
};
programs = {
vim.defaultEditor = true;
bash = {
enableCompletion = true;
promptInit =
let
UBG = "\\[$(tput setaf 21)\\]";
UFG = "\\[$(tput setaf 27)\\]";
RBG = "\\[$(tput setaf 124)\\]";
RFG = "\\[$(tput setaf 163)\\]";
in ''
if (( EUID == 0 )); then
PS1='${RBG}[${RFG}\u${RBG}@${RFG}\h${RBG}:${RFG}\w${RBG}]\$\[$(tput sgr0)\] '
else
PS1='${UBG}[${UFG}\u${UBG}@${UFG}\h${UBG}:${UFG}\w${UBG}]\$\[$(tput sgr0)\] '
fi
'';
};
#chromium = {
# defaultSearchProviderSearchURL = "https://duckduckgo.com?q={searchTerms}";
# extensions = [
# "cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin
# "ogfcmafjalglgifnmanfmnieipoejdcf" # uMatrix
# "dbepggeogbaibhgnhhndojpepiihcmeb" # Vimium
# ];
#};
};
networking = let wifi_nics = [ "wlan0" ]; in {
usePredictableInterfaceNames = false;
hostName = "rio";
wireless = {
enable = true;
interfaces = wifi_nics;
userControlled = {
enable = true;
group = "network";
};
};
dhcpcd = {
enable = true;
allowInterfaces = wifi_nics;
};
firewall = {
trustedInterfaces = [ "docker0" "xenbr0" ];
};
};
services = {
dbus.socketActivated = true;
nixosManual.showManual = true;
xserver = {
enable = true;
layout = "us";
displayManager.slim.enable = true;
windowManager.xmonad = {
enable = true;
extraPackages = haskellPackages: with haskellPackages; [
xmonad-contrib
xmonad-extras
fdo-notify
url
pkgs.acpi
];
};
synaptics = {
enable = true;
twoFingerScroll = true;
};
xkbOptions = "terminate:ctrl_alt_bksp, caps:ctrl_modifier";
};
acpid = {
enable = true;
handlers =
let
amixer = "${pkgs.alsaUtils}/bin/amixer";
backlight_dir = "/sys/class/backlight/intel_backlight";
modprobe = "${pkgs.kmod}/bin/modprobe";
systemctl = "${pkgs.systemd}/bin/systemctl";
in {
"mute" = {
event = "button/mute.*";
action = "${amixer} -c 1 set Master toggle";
};
"volumedown" = {
event = "button/volumedown.*";
action = "${amixer} -c 1 set Master 5dB-";
};
"volumeup" = {
event = "button/volumeup.*";
action = "${amixer} -c 1 set Master 5dB+";
};
"brightnessup" = {
event = "video/brightnessup.*";
action = ''
next=$(( $(cat ${backlight_dir}/actual_brightness) + 100 ))
max=$(cat ${backlight_dir}/max_brightness)
tee /dev/tty5 > ${backlight_dir}/brightness <<< $(( next > max ? max : next ))
'';
};
"brightnessdown" = {
event = "video/brightnessdown.*";
action = ''
next=$(( $(cat ${backlight_dir}/actual_brightness) - 100 ))
min=100
tee /dev/tty5 > ${backlight_dir}/brightness <<< $(( next < min ? min : next ))
'';
};
"wakeup" = { # This is a kludge. Also probably the wrong event regex.
event = "button/lid.*open.*";
action = ''
${modprobe} -r iwlwifi 2>/dev/null
${modprobe} iwlwifi
sleep 1
${systemctl} restart wpa_supplicant
'';
};
};
};
};
systemd.user.services = {
"dunst" = {
enable = true;
description = "";
wantedBy = [ "default.target" ];
serviceConfig.Restart = "always";
serviceConfig.RestartSec = 2;
serviceConfig.ExecStart = ''
${pkgs.dunst}/bin/dunst \
-geometry x1 \
-fn 'Hasklig 11' \
-lb '#000000' -nb '#000000' -cb '#000000' \
-lf '#339966' \
-nf '#993366' \
-cf '#996633' \
-history_key 'ctrl+shift+p' \
-key 'ctrl+shift+n'
'';
};
};
sound = {
enable = true;
extraConfig = ''
defaults.pcm.!card 1;
'';
};
users = {
users = {
"hamlinb" = {
isNormalUser = true;
extraGroups = [
"wheel"
"audio"
"network"
"docker"
"vboxusers"
];
};
};
groups = {
"network" = {};
};
};
virtualisation = {
virtualbox = {
host.enable = true;
};
xen = {
enable = true;
domain0MemorySize = 8192;
};
docker = {
enable = true;
};
};
# The NixOS release to be compatible with for stateful data such as databases.
system.stateVersion = "17.03";
}