mirror of
https://github.com/nix-community/disko.git
synced 2024-11-04 21:14:33 +03:00
112 lines
2.7 KiB
Nix
112 lines
2.7 KiB
Nix
{ disks ? [ "/dev/vdb" "/dev/vdc" ], ... }: {
|
|
disko.devices = {
|
|
disk = {
|
|
x = {
|
|
type = "disk";
|
|
device = builtins.elemAt disks 0;
|
|
content = {
|
|
type = "table";
|
|
format = "gpt";
|
|
partitions = [
|
|
{
|
|
name = "ESP";
|
|
start = "0";
|
|
end = "64MiB";
|
|
fs-type = "fat32";
|
|
bootable = true;
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
};
|
|
}
|
|
{
|
|
name = "zfs";
|
|
start = "128MiB";
|
|
end = "100%";
|
|
content = {
|
|
type = "zfs";
|
|
pool = "zroot";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
};
|
|
y = {
|
|
type = "disk";
|
|
device = builtins.elemAt disks 1;
|
|
content = {
|
|
type = "table";
|
|
format = "gpt";
|
|
partitions = [
|
|
{
|
|
name = "zfs";
|
|
start = "128MiB";
|
|
end = "100%";
|
|
content = {
|
|
type = "zfs";
|
|
pool = "zroot";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
};
|
|
};
|
|
zpool = {
|
|
zroot = {
|
|
type = "zpool";
|
|
mode = "mirror";
|
|
rootFsOptions = {
|
|
compression = "lz4";
|
|
"com.sun:auto-snapshot" = "false";
|
|
};
|
|
mountpoint = "/";
|
|
postCreateHook = "zfs snapshot zroot@blank";
|
|
|
|
datasets = {
|
|
zfs_fs = {
|
|
type = "zfs_fs";
|
|
mountpoint = "/zfs_fs";
|
|
options."com.sun:auto-snapshot" = "true";
|
|
};
|
|
zfs_unmounted_fs = {
|
|
type = "zfs_fs";
|
|
options.mountpoint = "none";
|
|
};
|
|
zfs_legacy_fs = {
|
|
type = "zfs_fs";
|
|
options.mountpoint = "legacy";
|
|
mountpoint = "/zfs_legacy_fs";
|
|
};
|
|
zfs_testvolume = {
|
|
type = "zfs_volume";
|
|
size = "10M";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "ext4";
|
|
mountpoint = "/ext4onzfs";
|
|
};
|
|
};
|
|
encrypted = {
|
|
type = "zfs_fs";
|
|
options = {
|
|
mountpoint = "none";
|
|
encryption = "aes-256-gcm";
|
|
keyformat = "passphrase";
|
|
keylocation = "file:///tmp/secret.key";
|
|
};
|
|
postCreateHook = ''
|
|
zfs set keylocation="prompt" "zroot/$name";
|
|
'';
|
|
};
|
|
"encrypted/test" = {
|
|
type = "zfs_fs";
|
|
mountpoint = "/zfs_crypted";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|
|
|