]> Git — Sourcephile - sourcephile-nix.git/blob - servers/mermet/production/zfs.nix
nix: shell: add ldns
[sourcephile-nix.git] / servers / mermet / production / zfs.nix
1 { pkgs, lib, config, ... }:
2
3 {
4 imports = [];
5
6 boot.supportedFilesystems = [ "zfs" ];
7
8 # The 32-bit host id of the machine, formatted as 8 hexadecimal characters.
9 # You should try to make this id unique among your machines.
10 # Manually generated with : head -c4 /dev/urandom | od -A none -t x4 | cut -d ' ' -f 2
11 networking.hostId = "69c40b03";
12
13 # none is the recommended elevator with ZFS (which has its own I/O scheduler)
14 # and/or for SSD, whereas HDD could use mq-deadline.
15 services.udev.extraRules = ''
16 # set none scheduler for non-rotating disks
17 ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
18 '';
19
20 # Ensure extra safeguards are active that zfs uses to protect zfs pools.
21 boot.zfs.forceImportAll = false;
22 boot.zfs.forceImportRoot = false;
23
24 boot.zfs.enableUnstable = true;
25 boot.zfs.requestEncryptionCredentials = true;
26
27 # Enables periodic scrubbing of ZFS pools.
28 services.zfs.autoScrub.enable = true;
29
30 environment = {
31 systemPackages = [
32 pkgs.mbuffer
33 pkgs.zfs
34 ];
35 };
36
37 /*
38 # Enable the (OpenSolaris-compatible) ZFS auto-snapshotting service.
39 services.zfs.autoSnapshot = {
40 enable = true;
41 frequent = ;
42 hourly = ;
43 daily = ;
44 weekly = ;
45 monthly = ;
46 };
47 */
48
49 /*
50 fileSystems."/boot" =
51 { device = "bpool/boot";
52 fsType = "zfs";
53 };
54 */
55 fileSystems."/" =
56 { device = "rpool/root";
57 fsType = "zfs";
58 };
59
60 fileSystems."/home" =
61 { device = "rpool/home";
62 fsType = "zfs";
63 };
64
65 fileSystems."/nix" =
66 { device = "rpool/nix";
67 fsType = "zfs";
68 };
69
70 fileSystems."/var" =
71 { device = "rpool/var";
72 fsType = "zfs";
73 };
74
75 fileSystems."/var/cache" =
76 { device = "rpool/var/cache";
77 fsType = "zfs";
78 };
79
80 fileSystems."/var/log" =
81 { device = "rpool/var/log";
82 fsType = "zfs";
83 };
84
85 fileSystems."/var/lib/dovecot" =
86 { device = "rpool/var/mail";
87 fsType = "zfs";
88 };
89
90 fileSystems."/var/tmp" =
91 { device = "rpool/var/tmp";
92 fsType = "zfs";
93 };
94
95 fileSystems."/var/www" =
96 { device = "rpool/var/www";
97 fsType = "zfs";
98 };
99 }