-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy paththird-notebook.nix
372 lines (308 loc) · 7.96 KB
/
third-notebook.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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
/*
Configuration for NixOS used by Michael Raskin
*/
{pkgs, config, modulesPath, ...}:
let
base =
{
require = [
];
environment = {
systemPackages = with pkgs;
[
openvpn gtkvnc firefox libreoffice icewm kde4.kdegames openssh
xarchiver vimHugeX gimp scite tigervnc
p7zip unzip zip unrar bzip2 gzip evince
udisks pmount
xlaunch zsh mtr subversion git screen nmap ncat tcpdump
sudo monotone
];
pathsToLink = ["/"];
};
boot = rec {
loader.grub = {
device = "/dev/sda";
copyKernels = true;
# I do not want to go near
# GRUB configuration count limit.
# Look in nix-dev
configurationLimit = 100;
version = 2;
};
# asus-laptop will let me adjust
# brightness
kernelModules = [
"fbcon" "radeonfb"
"usb-storage" "tun"
# "asus_laptop"
"battery" "ac" "thermal" "fuse" "kqemu"
"8139too" "p4_clockmod" "cp2101"
"ati_agp"
"ahci" "loop" "ftdi_sio" "snd_pcm" "snd_hda_intel" "radeon"
"ipip" "ipv6" "video"
"fbdev" "hid-generic"
"pata_atiixp" "sr_mod" "ahci" "pktcdvd" "ide-cd-mod"
"ath5k" "ath9k" "tun"
];
kernelPackages = pkgs.linuxPackages;
initrd = {
kernelModules = [
"libata" "sd_mod"
"i8042" "pcips2" "serio"
"mousedev" "evdev" "psmouse" "sermouse" "synaptics_i2c"
"ext3" "lzf" "crc32c" "btrfs" "libcrc32c"
"zlib_deflate" "unix" "usbhid" "ehci_hcd" "uhci_hcd"
"ohci_hcd" "atkbd" "xtkbd" "bfq_iosched"
"tuxonice_core" "tuxonice_swap" "tuxonice_userui"
];
};
kernelParams = [
"selinux=0"
"acpi=on"
"apm=off"
"console=tty1"
"splash=verbose"
];
vesa = false;
resumeDevice = "8:8";
hardwareScan = false;
postBootCommands = ''
! [ -e /tmp/.dev-tty12 ] && /var/run/current-system/sw/bin/mknod -m 0600 /tmp/.dev-tty12 c 4 12
/bin/sh -c 'while true; do
echo -n "Password: " ; read -s pass;
[ -e /root/.vt12-pass ] && [ "x$pass" = "x$(cat /root/.vt12-pass)" ] && /bin/sh;
[ "x$pass" = "xhaltnow" ] && /var/run/current-system/sw/sbin/halt;
[ "x$pass" = "xtouchstore" ] && /var/run/current-system/sw/bin/touch /nix/store &
done < /tmp/.dev-tty12 &> /tmp/.dev-tty12' &
'';
};
fileSystems = import ./filesystems-asus-n53j.nix {} ;
i18n = {
# My system is mixed utf-8/koi8-r
# Will be so while I ssh to koi8-r server
# luit solves the problem, though.
defaultLocale = "en_US.UTF-8";
#consoleFont = "koi8r-8x16";
consoleKeyMap = "ruwin_cplk-UTF-8";
};
networking = {
extraHosts = (import /root/nix-sysconfig/hosts.nix);
hostName = (import /root/nix-sysconfig/hostname.nix).hostname;
wireless.enable = true;
nameservers = [
] ++ (import /root/nix-sysconfig/nameservers.nix);
};
swapDevices = [
{ device = "/dev/sda8"; }
];
services = {
xserver = {
enable = true;
# Do not run on startup
autorun = true;
displayManager = {
slim = {
autoLogin = true;
defaultUser = "raskin";
};
desktopManagerHandlesLidAndPower=false;
};
desktopManager = {
xfce.enable = true;
xterm.enable = false;
};
# Create /etc/X11/xorg.conf for convenience
exportConfiguration = true;
# Needed by, say, xmove
enableTCP = true;
# WXGA. 15.4" widescreen
resolutions = [{x = 1280; y=800;} {x=1920; y=1080;}];
virtualScreen = {x=3072; y=1280;};
synaptics = {
enable = true;
dev = null;
};
# I get Caps-toggle between Latin/Cyrillic/Greek
# Right Flag key allows entering, say, euro sign
# or accents (using deadkeys in level 3)
# Look xkeyboard_config package source.
layout = "us,ru(winkeys)";
xkbOptions = "grp:alt_shift_toggle, grp_led:caps, terminate:ctrl_alt_bksp";
defaultDepth = 24;
# Will watch free ATi drivers progress...
# Force DRI on - or do not..
deviceSection = ''
Option "RenderAccel" "true"
Option "AccelMethod" "EXA"
'';
serverLayoutSection = ''
Option "AIGLX" "true"
#InputDevice "Mouse[0]"
'';
}
;
openssh = {
enable = true;
};
ntp = {
enable = true;
};
printing = {
enable = true;
drivers = [
pkgs.hplip
pkgs.foo2zjs pkgs.foomatic_filters
];
};
mingetty = {
helpLine = ''
0123456789 !@#$%^&*() -=\_+|
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
[]{};:'",./<>?~`
'';
};
gpm = {
enable = true;
};
cron = {
systemCronJobs = [
"0 0-23/6 * * * rm /var/log/gw6c.*.log"
];
};
atd = {
allowEveryone = true;
};
nixosManual.enable = false;
avahi = {
enable = true;
hostName = "401a0bf1";
};
openvpn.enable = true;
openvpn.servers = {
work = {
config=''
dev tun
persist-tun
persist-key
cipher AES-128-CBC
auth SHA1
tls-client
client
resolv-retry infinite
remote 195.178.216.103 1194 udp
lport 0
verify-x509-name "mccme-gw1 Server Cert." name
pkcs12 /root/nix-sysconfig/work-ovpn/mccme-gw1-udp-1194-raskina.p12
tls-auth /root/nix-sysconfig/work-ovpn/mccme-gw1-udp-1194-raskina-tls.key 1
ns-cert-type server
comp-lzo
ping-restart 100000
auth-user-pass /root/nix-sysconfig/work-ovpn/mccme-gw1-udp-1194-raskina-config.pass
'';
};
};
}
;
security = {
setuidPrograms = ["fusermount"
"mount" "umount" "sudo" "xlaunch"
"lsof" "suid-chroot" "fbterm" "pmount"
"pumount" "udisks"
];
setuidOwners = [
{
program = "sendmail";
group = "postdrop";
setgid = true;
}
{
program = "postdrop";
group = "postdrop";
setgid = true;
}
];
sudo = {
configFile = "
#generated
raskin ALL= NOPASSWD: /etc/sudo-scripts/setfreq,\\
/etc/sudo-scripts/standby,\\
/etc/sudo-scripts/xfs,\\
/var/run/current-system/sw/bin/wodim,\\
/var/run/current-system/sw/sbin/halt,\\
/etc/sudo-scripts/dateupdate,\\
/etc/sudo-scripts/eth,\\
/etc/sudo-scripts/wifi,\\
/etc/sudo-scripts/nonet,\\
/etc/sudo-scripts/up-ifs,\\
/etc/sudo-scripts/brightness,\\
/etc/sudo-scripts/renice0,\\
/etc/sudo-scripts/glusterfs-start,\\
/etc/sudo-scripts/gvpe-start,\\
/etc/sudo-scripts/chmod,\\
/run/current-system/sw/bin/systemctl restart openvpn-work,\\
/run/current-system/sw/bin/systemctl stop openvpn-work,\\
raskin ALL= NOPASSWD: SETENV: /etc/sudo-scripts/checkGw6
sshguest ALL= /var/run/current-system/sw/bin/ls /home/sshguest
wwwrun ALL= NOPASSWD: /var/run/current-system/sw/bin/mplayer,\\
/var/run/current-system/sw/bin/amixer
xserver ALL= NOPASSWD: /var/run/current-system/sw/sbin/start xserver,\\
/var/run/current-system/sw/sbin/stop xserver
halt ALL= NOPASSWD: /var/run/current-system/sw/sbin/halt
";
};
};
fonts = {
enableGhostscriptFonts = true;
# So there is a big directory in current-system
# with all fonts.
enableFontDir = true;
extraFonts = ([
(pkgs.ghostscript + "/share/ghostscript/fonts/")
pkgs.xorg.fontcronyxcyrillic
pkgs.xorg.fontadobe100dpi
pkgs.xorg.fontadobe75dpi
pkgs.xorg.fontxfree86type1
pkgs.mph_2b_damase
pkgs.dejavu_fonts
pkgs.liberation_ttf
pkgs.unifont
pkgs.wqy_zenhei
pkgs.clearlyU
pkgs.ucsFonts
pkgs.junicode
pkgs.lmodern
(pkgs.libertine.passthru.function {
createTTF = true;
createPFM = false;
createPFB = false;
createAFM = false;
createMAP = false;
createENC = false;
})
pkgs.arkpandora_ttf
pkgs.andagii
]);
enableCoreFonts = false;
};
time = {
timeZone = "Europe/Moscow";
};
nix = {
useChroot = true;
extraOptions = "
gc-keep-outputs = true # Nice for developers
gc-keep-derivations = true # Idem
env-keep-derivations = false
";
};
hardware = {
firmware = ["/var/lib/firmware"];
opengl.videoDrivers = ["ati" "intel"];
};
nixpkgs.config = import (builtins.getEnv "NIXPKGS_CONFIG");
};
in
# Everything above is building my base configuration.
# But I have multi-boot..
base