config/systems/x86_64-linux/earth/disk-config.nix

119 lines
3 KiB
Nix
Raw Normal View History

2025-05-23 19:48:46 -04:00
{
disko.devices = {
disk = {
2025-05-28 12:33:51 -04:00
main = {
2025-05-23 19:48:46 -04:00
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
2025-05-28 12:33:51 -04:00
mountOptions = ["umask=0077" "nofail"];
2025-05-23 19:48:46 -04:00
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
backup = {
type = "disk";
device = "/dev/nvme1n1";
content = {
type = "gpt";
partitions = {
2025-05-28 12:33:51 -04:00
zbk = {
2025-05-23 19:48:46 -04:00
size = "100%";
content = {
type = "zfs";
2025-05-28 12:33:51 -04:00
pool = "zbk";
2025-05-23 19:48:46 -04:00
};
};
};
};
};
};
zpool = {
2025-05-28 12:33:51 -04:00
zbk = {
2025-05-23 19:48:46 -04:00
type = "zpool";
rootFsOptions = {
acltype = "posixacl";
2025-05-28 12:33:51 -04:00
atime = "off";
compression = "zstd";
mountpoint = "none";
2025-05-23 19:48:46 -04:00
xattr = "sa";
2025-05-28 12:33:51 -04:00
autotrim = "on";
2025-05-23 19:48:46 -04:00
};
options.ashift = "12";
2025-05-28 12:33:51 -04:00
2025-05-23 19:48:46 -04:00
datasets = {
2025-05-28 12:33:51 -04:00
"zbk" = {
2025-05-23 19:48:46 -04:00
type = "zfs_fs";
2025-05-28 12:33:51 -04:00
options.mountpoint = "none";
2025-05-23 19:48:46 -04:00
};
2025-05-28 12:33:51 -04:00
"zbk/zbk" = {
2025-05-23 19:48:46 -04:00
type = "zfs_fs";
2025-05-28 12:33:51 -04:00
mountpoint = "/mnt/zbk";
options."sharesmb" = "on";
# Used by services.zfs.autoSnapshot options.
options."com.sun:auto-snapshot" = "true";
2025-05-23 19:48:46 -04:00
};
};
};
2025-05-28 12:33:51 -04:00
zroot = {
2025-05-23 19:48:46 -04:00
type = "zpool";
rootFsOptions = {
2025-05-28 12:33:51 -04:00
# https://wiki.archlinux.org/title/Install_Arch_Linux_on_ZFS
2025-05-23 19:48:46 -04:00
acltype = "posixacl";
2025-05-28 12:33:51 -04:00
atime = "off";
compression = "zstd";
mountpoint = "none";
2025-05-23 19:48:46 -04:00
xattr = "sa";
2025-05-28 12:33:51 -04:00
autotrim = "on";
2025-05-23 19:48:46 -04:00
};
options.ashift = "12";
2025-05-28 12:33:51 -04:00
2025-05-23 19:48:46 -04:00
datasets = {
2025-05-28 12:33:51 -04:00
"local" = {
2025-05-23 19:48:46 -04:00
type = "zfs_fs";
2025-05-28 12:33:51 -04:00
options.mountpoint = "none";
};
"local/home" = {
type = "zfs_fs";
mountpoint = "/home";
# Used by services.zfs.autoSnapshot options.
options."com.sun:auto-snapshot" = "true";
};
"local/nix" = {
type = "zfs_fs";
mountpoint = "/nix";
options."com.sun:auto-snapshot" = "false";
};
"local/persist" = {
type = "zfs_fs";
mountpoint = "/persist";
options."com.sun:auto-snapshot" = "false";
};
"local/root" = {
type = "zfs_fs";
mountpoint = "/";
options."com.sun:auto-snapshot" = "false";
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/local/root@blank$' || zfs snapshot zroot/local/root@blank";
2025-05-23 19:48:46 -04:00
};
};
};
};
};
}