Skip to content

Commit 0fa78e5

Browse files
committed
feat(alcyone): migrate to disko
1 parent 97c616f commit 0fa78e5

File tree

1 file changed

+51
-13
lines changed

1 file changed

+51
-13
lines changed

hosts/alcyone/hardware-configuration.nix

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
{
2-
imports = [../common/optional/ephemeral-btrfs.nix];
1+
{inputs, ...}: {
2+
imports = [
3+
../common/optional/ephemeral-btrfs.nix
4+
inputs.disko.nixosModules.disko
5+
];
36

47
boot = {
58
initrd = {
@@ -18,18 +21,53 @@
1821
};
1922
};
2023

21-
fileSystems."/boot" = {
22-
device = "/dev/disk/by-label/alcyone";
23-
fsType = "btrfs";
24-
options = ["subvol=boot"];
24+
disko.devices.disk.main = {
25+
device = "/dev/vda";
26+
type = "disk";
27+
# TODO: switch to gpt when reinstalling alcyone, eventually.
28+
content = {
29+
type = "table";
30+
format = "msdos";
31+
partitions = [{
32+
content = {
33+
type = "btrfs";
34+
postCreateHook = ''
35+
MNTPOINT=$(mktemp -d)
36+
mount -t btrfs "$device" "$MNTPOINT"
37+
trap 'umount $MNTPOINT; rm -d $MNTPOINT' EXIT
38+
btrfs subvolume snapshot -r $MNTPOINT/root $MNTPOINT/root-blank
39+
'';
40+
subvolumes = {
41+
"/boot" = {
42+
mountOptions = [];
43+
mountpoint = "/boot";
44+
};
45+
"/root" = {
46+
mountOptions = ["compress=zstd"];
47+
mountpoint = "/";
48+
};
49+
"/nix" = {
50+
mountOptions = ["noatime" "compress=zstd"];
51+
mountpoint = "/nix";
52+
};
53+
"/persist" = {
54+
mountOptions = ["compress=zstd"];
55+
mountpoint = "/persist";
56+
};
57+
"/swap" = {
58+
mountOptions = ["compress=zstd" "noatime"];
59+
mountpoint = "/swap";
60+
swap.swapfile = {
61+
size = "3072M";
62+
path = "swapfile";
63+
};
64+
};
65+
};
66+
};
67+
}];
68+
};
2569
};
26-
27-
swapDevices = [
28-
{
29-
device = "/swap/swapfile";
30-
size = 3072;
31-
}
32-
];
70+
fileSystems."/persist".neededForBoot = true;
3371

3472
hardware.cpu.intel.updateMicrocode = true;
3573

0 commit comments

Comments
 (0)