summaryrefslogtreecommitdiffstats
path: root/example/mdadm.nix
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-08-29 11:45:19 +0200
committerlassulus <lassulus@lassul.us>2022-09-02 11:14:58 +0200
commitdcb0c42857a2ada8754d4514d4b8c4c1d67ab3f5 (patch)
treed4c0f34db5bb060d9133fc03f57e68e46fdb86ff /example/mdadm.nix
parentadf901d58155ca268d15351fff164d3ef38a0890 (diff)
reimplement disko using the nixos type system
This should make the code cleaner, more robust and errors should be clearer. we also changed the configuration format a bit.
Diffstat (limited to 'example/mdadm.nix')
-rw-r--r--example/mdadm.nix72
1 files changed, 40 insertions, 32 deletions
diff --git a/example/mdadm.nix b/example/mdadm.nix
index cb0ad91..094499d 100644
--- a/example/mdadm.nix
+++ b/example/mdadm.nix
@@ -1,39 +1,47 @@
-# usage: nix-instantiate --eval --json --strict example/config.nix | jq .
{
- type = "devices";
- content = {
+ disk = {
vdb = {
- type = "table";
- format = "gpt";
- partitions = [
- {
- type = "partition";
- part-type = "primary";
- start = "1MiB";
- end = "100%";
- content = {
- type = "mdraid";
- name = "raid1";
- };
- }
- ];
+ type = "disk";
+ device = "/dev/vdb";
+ content = {
+ type = "table";
+ format = "gpt";
+ partitions = [
+ {
+ type = "partition";
+ name = "mdadm";
+ start = "1MiB";
+ end = "100%";
+ content = {
+ type = "mdraid";
+ name = "raid1";
+ };
+ }
+ ];
+ };
};
vdc = {
- type = "table";
- format = "gpt";
- partitions = [
- {
- type = "partition";
- part-type = "primary";
- start = "1MiB";
- end = "100%";
- content = {
- type = "mdraid";
- name = "raid1";
- };
- }
- ];
+ type = "disk";
+ device = "/dev/vdc";
+ content = {
+ type = "table";
+ format = "gpt";
+ partitions = [
+ {
+ type = "partition";
+ name = "mdadm";
+ start = "1MiB";
+ end = "100%";
+ content = {
+ type = "mdraid";
+ name = "raid1";
+ };
+ }
+ ];
+ };
};
+ };
+ mdadm = {
raid1 = {
type = "mdadm";
level = 1;
@@ -43,7 +51,7 @@
partitions = [
{
type = "partition";
- part-type = "primary";
+ name = "primary";
start = "1MiB";
end = "100%";
content = {