-
Notifications
You must be signed in to change notification settings - Fork 0
/
disko.nix
89 lines (89 loc) · 2.57 KB
/
disko.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
# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko.nix
# nixos-generate-config --no-filesystems --root /mnt
# mv /tmp/disko.nix /mnt/etc/nixos
# REMOVE: https://www.youtube.com/watch?v=nLwbNhSxLd4 (Full NixOS Guide)
# REMOVE: https://www.youtube.com/watch?v=YPKwkWtK7l0
# IMPORTANT: this disk configuration is setup for *impermanance* systems.
# to get rid of impermanance support, simply remove the "/persist" btrfs subvolume.
# to import, add this to the imports list:
# (import ./disko.nix { device = "/dev/?" })
{device ? throw "Set this to your disk device, e.g. /dev/disk/by-id/...", ...}: {
disko.devices = {
disk = {
main = {
inherit device;
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
name = "boot";
size = "1M";
type = "EF02";
};
ESP = {
name = "ESP";
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
passwordFile = "/tmp/secret.key";
settings = {
allowDiscards = true;
};
content = {
type = "lvm_pv";
vg = "root_vg";
};
};
};
swap = {
size = "35G";
content = {
type = "swap";
resumeDevice = true;
};
};
};
};
};
};
lvm_vg = {
root_vg = {
type = "lvm_vg";
lvs = {
root = {
size = "100%FREE";
content = {
type = "btrfs";
extraArgs = ["-f"];
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = ["compress=zstd" "noatime"];
};
"/home" = {
mountpoint = "/home";
mountOptions = ["compress=zstd" "noatime"];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = ["compress=zstd" "noatime"];
};
};
};
};
};
};
};
};
}