Skip to content

Commit c20485d

Browse files
committed
feat(hosts/celaeno): migrate to disko
1 parent aa26b37 commit c20485d

File tree

1 file changed

+56
-14
lines changed

1 file changed

+56
-14
lines changed

hosts/celaeno/hardware-configuration.nix

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
{modulesPath, ...}: {
1+
{inputs, modulesPath, ...}: {
22
imports = [
33
../common/optional/ephemeral-btrfs.nix
44
(modulesPath + "/profiles/qemu-guest.nix")
5+
inputs.disko.nixosModules.disko
56
];
67

8+
nixpkgs.hostPlatform.system = "aarch64-linux";
9+
710
# Slows down write operations considerably
811
nix.settings.auto-optimise-store = false;
912

@@ -26,19 +29,58 @@
2629
extraModprobeConfig = "options kvm nested=1";
2730
};
2831

29-
fileSystems = {
30-
"/boot" = {
31-
device = "/dev/disk/by-label/ESP";
32-
fsType = "vfat";
32+
disko.devices.disk.main = {
33+
device = "/dev/vda";
34+
type = "disk";
35+
content = {
36+
type = "gpt";
37+
partitions = {
38+
esp = {
39+
name = "ESP";
40+
size = "512M";
41+
type = "EF00";
42+
content = {
43+
type = "filesystem";
44+
format = "vfat";
45+
mountpoint = "/boot";
46+
};
47+
};
48+
root = {
49+
size = "100%";
50+
content = {
51+
type = "btrfs";
52+
postCreateHook = ''
53+
MNTPOINT=$(mktemp -d)
54+
mount -t btrfs "$device" "$MNTPOINT"
55+
trap 'umount $MNTPOINT; rm -d $MNTPOINT' EXIT
56+
btrfs subvolume snapshot -r $MNTPOINT/root $MNTPOINT/root-blank
57+
'';
58+
subvolumes = {
59+
"/root" = {
60+
mountOptions = ["compress=zstd"];
61+
mountpoint = "/";
62+
};
63+
"/nix" = {
64+
mountOptions = ["compress=zstd" "noatime"];
65+
mountpoint = "/nix";
66+
};
67+
"/persist" = {
68+
mountOptions = ["compress=zstd"];
69+
mountpoint = "/persist";
70+
};
71+
"/swap" = {
72+
mountOptions = ["compress=zstd" "noatime"];
73+
mountpoint = "/swap";
74+
swap.swapfile = {
75+
size = "8196M";
76+
path = "swapfile";
77+
};
78+
};
79+
};
80+
};
81+
};
82+
};
3383
};
3484
};
35-
36-
swapDevices = [
37-
{
38-
device = "/swap/swapfile";
39-
size = 8196;
40-
}
41-
];
42-
43-
nixpkgs.hostPlatform.system = "aarch64-linux";
85+
fileSystems."/persist".neededForBoot = true;
4486
}

0 commit comments

Comments
 (0)