-
Notifications
You must be signed in to change notification settings - Fork 5
/
backup-notebook.nix
366 lines (316 loc) · 9.6 KB
/
backup-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
/*
Configuration for NixOS used by Michael Raskin
- for backup notebook..
*/
{pkgs, config, modulesPath, ...}:
let
kernels = import /etc/nixos/configurations/misc/raskin/kernel-options.nix {inherit pkgs;};
texLivePaths = with pkgs; [texLive texLiveExtra texLiveCMSuper
texLiveBeamer lmodern texLiveContext];
myTexLive = pkgs.texLiveAggregationFun {
paths = texLivePaths;
};
bootEntries = baseKernel: rec {
# kernelPackages = let
# shippedKernelPackages = pkgs.linuxPackagesFor (baseKernel);
# in
# shippedKernelPackages //
# rec {
# klibc = shippedKernelPackages.klibc.passthru.function (x: {
# # version = "1.5.14";
# # sha256 = "1cmrqpgamnv2ns7dlxjm61zc88dxm4ff0aya413ij1lmhp2h2sfc";
# # subdir = "Testing/";
# addPreBuild = ''
# ln -s $PWD/linux/include/*/errno.h linux/include/asm || echo errno.h already present
# '';
# });
#
# klibcShrunk = shippedKernelPackages.klibcShrunk.passthru.function {
# inherit klibc;
# };
# };
kernelPackages = pkgs.linuxPackagesFor baseKernel;
extraModulePackages = [
/*(kernelPackages.kqemu.passthru.function (x : {
defU64 = {
text = ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -Du64=__u64"
'';
deps=[];
};
# version = "1.4.0pre1";
}))*/
/*(kernelPackages.kqemu.passthru.function (x : {
version = "1.4.0pre1";
}))*/
(kernelPackages.kqemu)
/*(myAtheros kernelPackages)*/
]
;
};
#kernelToUse = (bootEntries kernels.testingKernel);
kernelToUse = (bootEntries pkgs.linux_2_6_34);
packageGroups = import /etc/nixos/configurations/misc/raskin/package-groups.nix {
inherit pkgs myTexLive;
baseKernel = kernelToUse;
};
base =
{
require = [
/etc/nixos/nixos/modules/services/hardware/bluetooth.nix
/etc/nixos/configurations/tud/couchdb.nix
];
environment = {
systemPackages = with packageGroups;
[(pkgs.runCommand "empty" {} "mkdir $out")] ++
(if false then minimal else
(
pkgs.lib.concatLists
[
extractors consoleBrowsers programmingLanguages
nonNative hwControl toys filesystems networkTools
fatXApps windowManagers consoleTools buildSupport
utilsX widgets sound graphicView clientServer
misc GCPin versionControl fsTools consoleEditors
/*[
(pkgs.wrapFirefox pkgs.firefox3_5 "firefox" "")
pkgs.xulrunner3_5
pkgs.thunderbird pkgs.gajim pkgs.openoffice
pkgs.xterm pkgs.xorg.setxkbmap
pkgs.rxvt_unicode pkgs.openssh
pkgs.monotone pkgs.vimHugeX
pkgs.diffutils pkgs.subversion16
pkgs.utillinuxCurses pkgs.cdrkit
pkgs.zsh pkgs.wpa_supplicant
pkgs.iproute pkgs.squid pkgs.pythonFull
pkgs.xlaunch pkgs.screen pkgs.elinks
pkgs.xorg.xkbcomp pkgs.xsel pkgs.xorg.xorgserver
pkgs.xscreensaver pkgs.glxinfo
pkgs.neverball pkgs.binutils
pkgs.MPlayer pkgs.xpdf pkgs.evince
pkgs.gnupg2 pkgs.bc pkgs.xorg.xev
pkgs.xorg.xset pkgs.gnupg pkgs.pinentry
pkgs.btrfsProgs pkgs.lsof pkgs.manpages
pkgs.jfsUtils pkgs.gcc pkgs.jfsrec pkgs.bind
pkgs.zip pkgs.ncat pkgs.relfs pkgs.fuse
pkgs.smbfsFuse
]*/
/*(with pkgs.compizFusion;
[
pkgs.compiz
bcop ccsm ccsmSimple pluginsMain pluginsExtra
compizManager
])*/
misc GCPin versionControl consoleEditors]
);
# latest SVN or even personal uncommited version
nix = pkgs.nixCustomFun ("" + /etc/nixos/nix + "/")
""
["nix-reduce-build" "nix-http-export.cgi"]
["--with-docbook-xsl=${pkgs.docbook5_xsl}/xml/xsl/docbook/"
"--with-docbook-rng=${pkgs.docbook5}/xml/rng/docbook"
];
# I'd like to build ISO's and have them in profile
pathsToLink = ["/bin" "/sbin" "/share" "/man" "/info" "/iso" "/lib"];
# Most typos leave needed option at default
# (mystically..), but create easy-to-find
# options NixOS has no idea of. Build should break
# on them.
#checkConfigurationOptions = true;
};
boot = rec {
loader.grub = {
device = "/dev/sda";
extraGrubEntries = "
title Windows
chainloader (hd0,1)+1
";
copyKernels = true;
# I do not want to go near
# GRUB configuration count limit.
# Look in nix-dev
configurationLimit = 100;
};
# 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"
"pata_atiixp" "sr_mod" "ahci" "pktcdvd" "ide-cd-mod"
];
# S3 is broken for now,
# TuxOnIce works (not in latest kernel yet)
extraKernelParams = ["resume=/dev/sda8" "acpi_sleep=s3_bios"];
kernelPackages = kernelToUse.kernelPackages;
extraModulePackages = kernelToUse.extraModulePackages;
initrd = {
kernelModules = [
"libata" "sd_mod"
"i8042" "pcips2" "serio"
"mousedev" "evdev" "psmouse" "sermouse" "synaptics_i2c"
"ext3" "lzf" "crc32c" "btrfs" "libcrc32c"
"zlib_deflate" "unix" "usbhid" "uhci_hcd" "ehci_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 = [
{
mountPoint ="/";
device="/dev/sda6";
fsType="ext3";
options="acl,user_xattr";
}
];
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);
# I manage proxy settings manually anyway
interfaceMonitor = {
enable = false;
};
nameservers = [
] ++ (import /root/nix-sysconfig/nameservers.nix);
};
installer = {
# Life is easier to control like that
manifests = if false then [] else [
http://hydra.nixos.org/project/nixpkgs/channel/latest/MANIFEST
http://hydra.nixos.org/job/nix/trunk/build/channel/latest/MANIFEST
http://hydra.nixos.org/project/nixos/channel/latest/MANIFEST
http://nixos.org/releases/nixpkgs/channels/nixpkgs-unstable/MANIFEST
];
repoTypes = {
svn = { valid = "[ -d .svn ]"; env = [ pkgs.coreutils pkgs.subversion ]; };
git = { valid = "[ -d .git ]"; env = [ pkgs.coreutils pkgs.git pkgs.gnused /* FIXME: use full path to sed in nix-pull */ ]; };
};
};
swapDevices = [
];
services = import /etc/nixos/configurations/misc/raskin/services-main.nix {inherit pkgs config;};
security = {
extraSetuidPrograms = ["fusermount"
"mount" "umount" "sudo" "xlaunch"
"lsof" "suid-chroot" "fbterm"
];
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
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 = import /etc/nixos/configurations/misc/raskin/fonts.nix {inherit pkgs;};
time = {
timeZone = "Europe/Moscow";
};
nix = {
extraOptions = "
gc-keep-outputs = true # Nice for developers
gc-keep-derivations = true # Idem
env-keep-derivations = false
";
proxy = "http://127.0.0.1:3128";
};
jobs = {
cleanXserverLock = {
name = "clean-xserver-lock";
description = "Clean X lock files";
startOn = "filesystem";
script = ''
if ! pgrep X; then
rm /tmp/.X*-lock;
fi
'';
respawn = false;
};
networkInterfaces.startOn = "never";
};
nixpkgs.config = import (builtins.getEnv "NIXPKGS_CONFIG");
};
in
# Everything above is building my base configuration.
# But I have multi-boot..
base //
{
nesting = {
# nesting.children - they are included in menu.lst
children = [
# They are all similar to main configuration, which
# reflects my taste
];
};
hardware = {
firmware = ["/var/lib/firmware"];
};
passthru = {
};
}