Skip to content

Commit 97c616f

Browse files
committed
feat(atlas): migrate to disko
1 parent 738f275 commit 97c616f

File tree

2 files changed

+63
-20
lines changed

2 files changed

+63
-20
lines changed

hosts/atlas/hardware-configuration.nix

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{
1+
{inputs, ...}: {
22
imports = [
3+
inputs.disko.nixosModules.disko
34
../common/optional/ephemeral-btrfs.nix
4-
../common/optional/encrypted-root.nix
55
];
66

77
nixpkgs.hostPlatform.system = "x86_64-linux";
@@ -33,17 +33,67 @@
3333
};
3434
};
3535

36-
fileSystems = {
37-
"/boot" = {
38-
device = "/dev/disk/by-label/ESP";
39-
fsType = "vfat";
36+
disko.devices.disk.main = {
37+
device = "/dev/nvme0n1";
38+
type = "disk";
39+
content = {
40+
type = "gpt";
41+
partitions = {
42+
boot = {
43+
size = "1M";
44+
type = "EF02";
45+
};
46+
esp = {
47+
name = "ESP";
48+
size = "512M";
49+
type = "EF00";
50+
content = {
51+
type = "filesystem";
52+
format = "vfat";
53+
mountpoint = "/boot";
54+
};
55+
};
56+
luks = {
57+
size = "100%";
58+
content = {
59+
name = "root";
60+
type = "luks";
61+
settings.allowDiscards = true;
62+
content = {
63+
type = "btrfs";
64+
postCreateHook = ''
65+
MNTPOINT=$(mktemp -d)
66+
mount -t btrfs "$device" "$MNTPOINT"
67+
trap 'umount $MNTPOINT; rm -d $MNTPOINT' EXIT
68+
btrfs subvolume snapshot -r $MNTPOINT/root $MNTPOINT/root-blank
69+
'';
70+
subvolumes = {
71+
"/root" = {
72+
mountOptions = ["compress=zstd"];
73+
mountpoint = "/";
74+
};
75+
"/nix" = {
76+
mountOptions = ["compress=zstd" "noatime"];
77+
mountpoint = "/nix";
78+
};
79+
"/persist" = {
80+
mountOptions = ["compress=zstd"];
81+
mountpoint = "/persist";
82+
};
83+
"/swap" = {
84+
mountOptions = ["compress=zstd" "noatime"];
85+
mountpoint = "/swap";
86+
swap.swapfile = {
87+
size = "8196M";
88+
path = "swapfile";
89+
};
90+
};
91+
};
92+
};
93+
};
94+
};
95+
};
4096
};
4197
};
42-
43-
swapDevices = [
44-
{
45-
device = "/swap/swapfile";
46-
size = 8196;
47-
}
48-
];
98+
fileSystems."/persist".neededForBoot = true;
4999
}

hosts/common/optional/encrypted-root.nix

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)