blob: 3bd72300adf33006d2d7e5447336974669604c13 (
plain) (
blame)
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
|
{
config,
lib,
pkgs,
this,
...
}:
with lib; {
nixfiles.modules = {
ark.enable = true;
wireguard.client.enable = true;
syncthing.enable = true;
openssh.server.enable = true;
games = {
lutris.enable = true;
minecraft.client.enable = true;
steam.enable = true;
};
android.enable = true;
bluetooth.enable = true;
discord.enable = true;
libvirtd.enable = true;
qutebrowser.enable = true;
mpd.enable = true;
};
hm = {
home.packages = with pkgs; [obs-studio];
programs = {
# NOTE This produces very poor performance even though RX 6750 XT should
# handle VA-API hardware decoding for all major formats (including AV1) just
# fine.
firefox.profiles.default.settings."media.ffmpeg.vaapi.enabled" = false;
# Mostly just placebo. :^)
mpv.config = {
hwdec = "vdpau";
vo = "gpu";
profile = "gpu-hq";
};
};
};
# Usually stuff that is going to be compiled on this machine is going to have
# parallelisation support enabled, so we will make sure that all cores are
# utilised and limit the job queue to one.
nix.extraOptions = ''
keep-going = true
max-jobs = 1
cores = 32
'';
boot = {
# TODO Override Xanmod kernel to support ZFS. This probably will require
# some patching and whatnot.
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
# Silence benign MCE errors:
# ```
# mce: [Hardware Error]: CPU 1: Machine Check: 0 Bank 29: ffffffffffffffff
# mce: [Hardware Error]: TSC 0 MISC ff1fffffffffffff SYND ffffffffffffffff IPID ffffffffffffffff
# mce: [Hardware Error]: PROCESSOR 2:a60f12 TIME 1669988017 SOCKET 0 APIC 2 microcode a601201
# ```
kernelParams = ["mce=nobootlog"];
# The boot drive is Samsung SSD 980 PRO 2TB.
initrd.kernelModules = ["nvme"];
zfs.extraPools = ["vdata"];
};
# Filesystem creation:
# ```
# mkfs.vfat -F 32 -l nixos-boot /dev/nvmeXnYpZ
#
# zpool create
# -o ashift=12
# -o autotrim=on
# -O acltype=posixacl
# -O xattr=sa
# -O compression=zstd
# -O mountpoint=none
# nixos
# /dev/nvmeXnYpZ
#
# zfs create
# nixos/root
#
# zfs create
# -o encryption=aes-256-gcm
# -o keyformat=passphrase
# -o mountpoint=legacy
# nixos/root/ark
#
# zfs create
# -o mountpoint=legacy
# nixos/root/nix
# ```
fileSystems = {
"/" = {
device = "none";
fsType = "tmpfs";
options = ["size=8G" "mode=755"];
};
"/boot" = {
device = "/dev/disk/by-uuid/1363-02E6";
fsType = "vfat";
};
"/nix" = {
device = "nixos/root/nix";
fsType = "zfs";
options = ["noatime"];
};
${config.ark.path} = {
device = "nixos/root/ark";
fsType = "zfs";
neededForBoot = true; # Required by impermanence.
};
# Required[1] when using impermanence with agenix. Filesystem itself is
# defined as an `ark.directory` in `nixos/common/users.nix`.
#
# [1]: https://github.com/ryantm/agenix/issues/45#issuecomment-847852593
# [1]: https://github.com/nix-community/impermanence/issues/22
# [1]: https://github.com/NixOS/nixpkgs/pull/86967#pullrequestreview-667929259
"/home/${my.username}" = {
depends = [config.ark.path];
neededForBoot = true;
};
};
# No swap space is declared here because the system already has 128Gb of RAM. :^)
# I've only manage to hit around 100Gb mark when running large
# computations/compiling something big. Pretty sure that a hefty chunk of it
# was just residual cache and it wouldn't make me get to OOM situations.
}
|