130 lines
3.1 KiB
Nix
130 lines
3.1 KiB
Nix
|
|
{pkgs, ...}: {
|
||
|
|
disko.devices.disk = {
|
||
|
|
main = {
|
||
|
|
device = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0";
|
||
|
|
type = "disk";
|
||
|
|
content = {
|
||
|
|
type = "gpt";
|
||
|
|
partitions = {
|
||
|
|
boot = {
|
||
|
|
size = "1M";
|
||
|
|
type = "EF02"; # for grub MBR
|
||
|
|
};
|
||
|
|
root = {
|
||
|
|
size = "100%";
|
||
|
|
content = {
|
||
|
|
type = "filesystem";
|
||
|
|
format = "ext4";
|
||
|
|
mountpoint = "/";
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
disk1 = {
|
||
|
|
device = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1";
|
||
|
|
type = "disk";
|
||
|
|
content = {
|
||
|
|
type = "gpt";
|
||
|
|
partitions.luks = {
|
||
|
|
size = "100%";
|
||
|
|
content = {
|
||
|
|
type = "luks";
|
||
|
|
name = "disk1";
|
||
|
|
passwordFile = "/tmp/pass.key";
|
||
|
|
content = {
|
||
|
|
type = "filesystem";
|
||
|
|
format = "ext4";
|
||
|
|
mountpoint = "/mnt/disk1";
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
disk2 = {
|
||
|
|
device = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi2";
|
||
|
|
type = "disk";
|
||
|
|
content = {
|
||
|
|
type = "gpt";
|
||
|
|
partitions.luks = {
|
||
|
|
size = "100%";
|
||
|
|
content = {
|
||
|
|
type = "luks";
|
||
|
|
name = "disk2";
|
||
|
|
passwordFile = "/tmp/pass.key";
|
||
|
|
content = {
|
||
|
|
type = "filesystem";
|
||
|
|
format = "ext4";
|
||
|
|
mountpoint = "/mnt/disk2";
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
disk3 = {
|
||
|
|
device = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi3";
|
||
|
|
type = "disk";
|
||
|
|
content = {
|
||
|
|
type = "gpt";
|
||
|
|
partitions.luks = {
|
||
|
|
size = "100%";
|
||
|
|
content = {
|
||
|
|
type = "luks";
|
||
|
|
name = "disk3";
|
||
|
|
passwordFile = "/tmp/pass.key";
|
||
|
|
content = {
|
||
|
|
type = "filesystem";
|
||
|
|
format = "ext4";
|
||
|
|
mountpoint = "/mnt/disk3";
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
parity = {
|
||
|
|
device = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi4";
|
||
|
|
type = "disk";
|
||
|
|
content = {
|
||
|
|
type = "gpt";
|
||
|
|
partitions.luks = {
|
||
|
|
size = "100%";
|
||
|
|
content = {
|
||
|
|
type = "luks";
|
||
|
|
name = "parity";
|
||
|
|
passwordFile = "/tmp/pass.key";
|
||
|
|
content = {
|
||
|
|
type = "filesystem";
|
||
|
|
format = "ext4";
|
||
|
|
mountpoint = "/mnt/parity";
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
environment.systemPackages = [
|
||
|
|
pkgs.mergerfs
|
||
|
|
pkgs.snapraid
|
||
|
|
];
|
||
|
|
fileSystems."/mnt/pool" = {
|
||
|
|
fsType = "fuse.mergerfs";
|
||
|
|
device = "/mnt/disk*";
|
||
|
|
options = [
|
||
|
|
"cache.files=off"
|
||
|
|
"dropcacheonclose=true"
|
||
|
|
"category.create=eplus"
|
||
|
|
];
|
||
|
|
};
|
||
|
|
environment.etc."snapraid.conf".text = ''
|
||
|
|
parity /mnt/parity/snapraid.parity
|
||
|
|
content /var/snapraid.content
|
||
|
|
content /mnt/disk1/general/snapraid.content
|
||
|
|
content /mnt/disk2/general/snapraid.content
|
||
|
|
content /mnt/disk3/general/snapraid.content
|
||
|
|
data d1 /mnt/disk1/
|
||
|
|
data d2 /mnt/disk2/
|
||
|
|
data d3 /mnt/disk3/
|
||
|
|
exclude /lost+found/
|
||
|
|
'';
|
||
|
|
}
|