mirror of
https://github.com/nix-community/disko.git
synced 2024-09-17 09:37:17 +03:00
add flag support
This commit is contained in:
parent
c40b0dc031
commit
fc568cf797
33
example/config-gpt-bios.nix
Normal file
33
example/config-gpt-bios.nix
Normal file
@ -0,0 +1,33 @@
|
||||
# Example to create a bios compatible gpt partition
|
||||
{
|
||||
type = "devices";
|
||||
content = {
|
||||
sda = {
|
||||
type = "table";
|
||||
format = "gpt";
|
||||
partitions = [
|
||||
{
|
||||
type = "partition";
|
||||
start = "0";
|
||||
end = "1M";
|
||||
part-type = "primary";
|
||||
flags = ["bios_grub"];
|
||||
content.type = "noop";
|
||||
}
|
||||
{
|
||||
type = "partition";
|
||||
# leave space for the grub aka BIOS boot
|
||||
start = "1M";
|
||||
end = "100%";
|
||||
part-type = "primary";
|
||||
bootable = true;
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
@ -24,6 +24,7 @@
|
||||
part-type = "primary";
|
||||
start = "1024MiB";
|
||||
end = "100%";
|
||||
flags = [ "bios_grub" ];
|
||||
content = {
|
||||
type = "luks";
|
||||
algo = "aes-xts...";
|
||||
|
@ -3,11 +3,13 @@
|
||||
let
|
||||
# TODO: get rid of NIX_PATH dependency here
|
||||
pkgs = import <nixpkgs> {};
|
||||
cfg = import ./config.nix;
|
||||
#cfg = import ./config-gpt-bios.nix;
|
||||
in
|
||||
with import ../lib { inherit (pkgs) lib;};
|
||||
|
||||
{
|
||||
config = config (import ./config.nix);
|
||||
create = create (import ./config.nix);
|
||||
mount = mount (import ./config.nix);
|
||||
config = config cfg;
|
||||
create = create cfg;
|
||||
mount = mount cfg;
|
||||
}
|
||||
|
@ -75,6 +75,9 @@ let {
|
||||
${optionalString (x.bootable or false) ''
|
||||
parted -s ${q.device} set ${toString q.index} boot on
|
||||
''}
|
||||
${concatMapStringsSep "" (flag: ''
|
||||
parted -s ${q.device} set ${toString q.index} ${flag} on
|
||||
'') (x.flags or [])}
|
||||
${create-f { device = q.device + toString q.index; } x.content}
|
||||
'';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user