Last active
December 18, 2022 11:44
-
-
Save Mic92/60fd0f02090a7acd5f2e6dd8a6006fb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
boot.initrd.availableKernelModules = [ | |
"xhci_pci" | |
"ahci" | |
"nvme" | |
]; | |
disko.devices = import ./raid-config.nix { | |
raidLevel = 1; | |
}; | |
# / is a mirror raid | |
boot.loader.grub.devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ]; | |
# for mdraid 1.1 | |
boot.loader.grub.extraConfig = "insmod mdraid1x"; | |
boot.loader.grub.enable = true; | |
boot.loader.grub.version = 2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ raidLevel ? 1 }: | |
let | |
biosBoot = { | |
type = "partition"; | |
start = "0MB"; | |
end = "1MB"; | |
name = "boot"; | |
flags = [ "bios_grub" ]; | |
}; | |
efiBoot = { | |
type = "partition"; | |
name = "ESP"; | |
start = "1MB"; | |
end = "500MB"; | |
bootable = true; | |
content = { | |
type = "mdraid"; | |
name = "boot"; | |
}; | |
}; | |
raidPart = { | |
type = "partition"; | |
name = "raid-root"; | |
start = "500MB"; | |
end = "100%"; | |
bootable = true; | |
content = { | |
type = "mdraid"; | |
name = "root"; | |
}; | |
}; | |
in | |
{ | |
disk = { | |
nvme0n1 = { | |
type = "disk"; | |
device = "/dev/nvme0n1"; | |
content = { | |
type = "table"; | |
format = "gpt"; | |
partitions = [ | |
biosBoot | |
efiBoot | |
raidPart | |
]; | |
}; | |
}; | |
nvme1n1 = { | |
type = "disk"; | |
device = "/dev/nvme1n1"; | |
content = { | |
type = "table"; | |
format = "gpt"; | |
partitions = [ | |
biosBoot | |
efiBoot | |
raidPart | |
]; | |
}; | |
}; | |
}; | |
mdadm = { | |
boot = { | |
type = "mdadm"; | |
# if one disk fails we can boot at least a kernel and show what is going on. | |
level = 1; | |
# metadata 1.0 so we can use it as an esp partition | |
metadata = "1.0"; | |
content = { | |
type = "filesystem"; | |
format = "vfat"; | |
mountpoint = "/boot"; | |
}; | |
}; | |
root = { | |
type = "mdadm"; | |
level = raidLevel; | |
content = { | |
type = "filesystem"; | |
format = "ext4"; | |
mountpoint = "/"; | |
}; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment