2023-04-27 22:43:52 +02:00
|
|
|
# nix run github:nix-community/disko -- --mode create ./disko-config-chungus.nix --dry-run
|
|
|
|
# nix run github:nix-community/disko -- --mode mount ./disko-config-chungus.nix --dry-run
|
|
|
|
# nixos-generate-config --root /mnt/
|
|
|
|
# vim /mnt/configuration.nix
|
|
|
|
# nixos-install --root /mnt
|
|
|
|
|
2023-04-28 07:44:34 +02:00
|
|
|
{ raid_disks ? {
|
|
|
|
"HITACHI_E3834563CDU11M" = "/dev/disk/by-id/ata-HITACHI_HTS723232A7A364_E3834563CDU11M";
|
|
|
|
"HITACHI_E3834563CDU12M" = "/dev/disk/by-id/ata-HITACHI_HTS723232A7A364_E3834563CDU12M";
|
|
|
|
"HITACHI_E3834563CDU13M" = "/dev/disk/by-id/ata-HITACHI_HTS723232A7A364_E3834563CDU13M";
|
|
|
|
"HITACHI_E3834563CDU15M" = "/dev/disk/by-id/ata-HITACHI_HTS723232A7A364_E3834563CDU15M";
|
|
|
|
"HITACHI_E3834563CDU17M" = "/dev/disk/by-id/ata-HITACHI_HTS723232A7A364_E3834563CDU17M";
|
|
|
|
}
|
2023-04-27 22:43:52 +02:00
|
|
|
, ...
|
|
|
|
}: {
|
|
|
|
disko.devices = {
|
|
|
|
disk = {
|
|
|
|
root = {
|
|
|
|
type = "disk";
|
|
|
|
device = "/dev/nvme0n1";
|
|
|
|
content = {
|
|
|
|
type = "table";
|
|
|
|
format = "gpt";
|
|
|
|
partitions = [
|
|
|
|
{
|
|
|
|
type = "partition";
|
|
|
|
name = "ESP";
|
|
|
|
start = "0";
|
|
|
|
end = "500MiB";
|
|
|
|
bootable = true;
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "vfat";
|
|
|
|
mountpoint = "/boot";
|
|
|
|
mountOptions = [
|
|
|
|
"defaults"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "zfs";
|
|
|
|
start = "500MiB";
|
|
|
|
end = "100%";
|
|
|
|
content = {
|
|
|
|
type = "luks";
|
|
|
|
name = "root";
|
|
|
|
#keyFile = "/tmp/secret.key";
|
|
|
|
content = {
|
|
|
|
type = "zfs";
|
|
|
|
pool = "zroot";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2023-04-28 07:44:34 +02:00
|
|
|
} // mapAttrs
|
|
|
|
(name: device_path:
|
2023-04-27 22:43:52 +02:00
|
|
|
{
|
2023-04-28 07:44:34 +02:00
|
|
|
name = name;
|
2023-04-27 22:43:52 +02:00
|
|
|
value = {
|
|
|
|
type = "disk";
|
2023-04-28 07:44:34 +02:00
|
|
|
device = device_path;
|
2023-04-27 22:43:52 +02:00
|
|
|
content = {
|
|
|
|
type = "table";
|
|
|
|
format = "gpt";
|
|
|
|
partitions = [
|
|
|
|
{
|
|
|
|
name = "zfs";
|
|
|
|
start = "0";
|
|
|
|
end = "100%";
|
|
|
|
content = {
|
|
|
|
type = "luks";
|
2023-04-28 07:44:34 +02:00
|
|
|
name = "raid_${name}";
|
2023-04-27 22:43:52 +02:00
|
|
|
#keyFile = "/tmp/secret.key";
|
|
|
|
content = {
|
|
|
|
type = "zfs";
|
|
|
|
pool = "zraid";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
)
|
|
|
|
raid_disks;
|
|
|
|
|
|
|
|
zpool = {
|
|
|
|
|
|
|
|
zroot = {
|
|
|
|
type = "zpool";
|
2023-04-28 08:19:42 +02:00
|
|
|
rootFsOptions.compression = "lz4";
|
2023-04-27 22:43:52 +02:00
|
|
|
datasets = {
|
|
|
|
"root" = {
|
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = "/";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
zraid = {
|
|
|
|
type = "zpool";
|
|
|
|
mode = "raidz2";
|
|
|
|
datasets = {
|
|
|
|
"media" = {
|
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = "/media";
|
|
|
|
};
|
|
|
|
"media/nextcloud" = {
|
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = "/media/nextcloud";
|
|
|
|
options = {
|
|
|
|
# question: is that combination of frequency and keep even possible?
|
|
|
|
"com.sun:auto-snapshot" = "false";
|
|
|
|
"com.sun:auto-snapshot:daily,keep=32" = "true";
|
|
|
|
"com.sun:auto-snapshot:weekly,keep=52" = "true";
|
|
|
|
"com.sun:auto-snapshot:montly,keep=24" = "true";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|