image: make the gpt headerHole configurable

This commit is contained in:
colin 2022-06-24 00:53:43 -07:00
parent 2e7795a938
commit 17d2029ba2
2 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,8 @@
{ config, pkgs, ... }:
{
# we need space in the GPT header to place tow-boot.
# only actually need 1 MB, but better to over-allocate than under-allocate
colinsane.image.extraGPTPadding = 16 * 1024 * 1024;
system.build.img = pkgs.runCommandNoCC "nixos_full-disk-image.img" {} ''
cp -v ${config.system.build.img-without-firmware}/nixos.img $out
chmod +w $out

View File

@ -10,6 +10,10 @@ in
default = [];
type = types.listOf types.package;
};
colinsane.image.extraGPTPadding = mkOption {
default = 0;
type = types.int;
};
};
config = let
# return true if super starts with sub
@ -52,8 +56,7 @@ in
# leave some space for firmware
# TODO: we'd prefer to turn this into a protected firmware partition, rather than reserving space in the GPT header itself
# Tow-Boot manages to do that; not sure how.
# TODO: does this method work on all systems (test on lappy)
headerHole = imageBuilder.size.MiB 16;
headerHole = cfg.extraGPTPadding;
partitions = [
(fsBuilderMapBoot."${bootFs.fsType}" {
# fs properties