From bef4bda8dd1655ec76849059c5dbd7c5de6eaebe Mon Sep 17 00:00:00 2001 From: Colin L Rice Date: Wed, 1 Jul 2020 12:01:48 -0400 Subject: [PATCH] sd-image: Add option to control sd image expansion on boot. This is supeer useful to allow the normal sd-image code to be used by someone who wants to setup multiple partitions with a sd-image. Currently I'm manually copying the sd-image file and modifying it instead. --- nixos/modules/installer/sd-card/sd-image.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nixos/modules/installer/sd-card/sd-image.nix b/nixos/modules/installer/sd-card/sd-image.nix index b811ae07eb0..45c8c67169b 100644 --- a/nixos/modules/installer/sd-card/sd-image.nix +++ b/nixos/modules/installer/sd-card/sd-image.nix @@ -126,6 +126,13 @@ in ''; }; + expandOnBoot = mkOption { + type = types.bool; + default = true; + description = '' + Whether to configure the sd image to expand it's partition on boot. + ''; + }; }; config = { @@ -215,7 +222,7 @@ in ''; }) {}; - boot.postBootCommands = '' + boot.postBootCommands = lib.mkIf config.sdImage.expandOnBoot '' # On the first boot do some maintenance tasks if [ -f /nix-path-registration ]; then set -euo pipefail