mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2025-12-11 23:50:05 +01:00
add top-level layout type
This commit is contained in:
parent
6232ab3078
commit
7262439401
2 changed files with 63 additions and 51 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue