summary refs log tree commit diff
path: root/nixos/modules/installer/sd-card
diff options
context:
space:
mode:
authorColin L Rice <colin@daedrum.net>2020-07-01 12:01:48 -0400
committerColin L Rice <colin@daedrum.net>2021-04-30 22:12:07 -0400
commitbef4bda8dd1655ec76849059c5dbd7c5de6eaebe (patch)
tree21ca851a1e832faae3cc3d6c19fe4e34f37e113a /nixos/modules/installer/sd-card
parentbd64a6221f18a24c79b879c0441f4420f0f2d47e (diff)
downloadnixpkgs-bef4bda8dd1655ec76849059c5dbd7c5de6eaebe.tar
nixpkgs-bef4bda8dd1655ec76849059c5dbd7c5de6eaebe.tar.gz
nixpkgs-bef4bda8dd1655ec76849059c5dbd7c5de6eaebe.tar.bz2
nixpkgs-bef4bda8dd1655ec76849059c5dbd7c5de6eaebe.tar.lz
nixpkgs-bef4bda8dd1655ec76849059c5dbd7c5de6eaebe.tar.xz
nixpkgs-bef4bda8dd1655ec76849059c5dbd7c5de6eaebe.tar.zst
nixpkgs-bef4bda8dd1655ec76849059c5dbd7c5de6eaebe.zip
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.
Diffstat (limited to 'nixos/modules/installer/sd-card')
-rw-r--r--nixos/modules/installer/sd-card/sd-image.nix9
1 files changed, 8 insertions, 1 deletions
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