mirror of
https://github.com/nix-community/disko.git
synced 2024-09-11 06:25:33 +03:00
add top-level layout type
This commit is contained in:
parent
6232ab3078
commit
7262439401
@ -1,5 +1,8 @@
|
||||
# usage: nix-instantiate --eval --json --strict example/config.nix | jq .
|
||||
{
|
||||
type = "layout";
|
||||
content = {
|
||||
"/dev/sda" = {
|
||||
type = "table";
|
||||
format = "gpt";
|
||||
partitions = [
|
||||
@ -54,4 +57,6 @@
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -12,6 +12,9 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
config.layout = q: x:
|
||||
foldl' mergeAttrs {} (mapAttrsToList (name: config-f { device = name; }) x.content);
|
||||
|
||||
config.lv = q: x:
|
||||
config-f { device = "/dev/${q.vgname}/${q.name}"; } x.content;
|
||||
|
||||
@ -35,6 +38,10 @@ let
|
||||
mkfs.${x.format} ${q.device}
|
||||
'';
|
||||
|
||||
format.layout = q: x: ''
|
||||
${concatStrings (mapAttrsToList (name: format-f { device = name; }) x.content)}
|
||||
'';
|
||||
|
||||
format.lv = q: x: ''
|
||||
lvcreate -L ${x.size} -n ${q.name} ${q.vgname}
|
||||
${format-f { device = "/dev/${q.vgname}/${q.name}"; } x.content}
|
||||
|
Loading…
Reference in New Issue
Block a user