From f70105e8fff0d5f5ef3df8f70f5c2584363e741a Mon Sep 17 00:00:00 2001 From: Padreug Date: Mon, 27 Jul 2026 17:58:22 +0200 Subject: [PATCH] feat(deploy): add self-growing disk-image-batm3 target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit batm3-installed existed as a nixosConfiguration but had no dd-able disk image (only the live ISO, which is tmpfs — no persistent state.db/.env). Mirrors the douro/sintra make-disk-image blocks, with one improvement: boot.growPartition + fileSystems."/".autoResize so the root partition and ext4 expand to fill the target drive on first boot. Flashing is dd-and-done — no manual parted/resize2fs — and the full drive is available to the nix store from day one (the #55 headroom lesson). Image-only override via extendModules: the running system's batm3-installed config (what auto-upgrade rebuilds against) is unchanged. Build: nix build .#disk-image-batm3 → result/nixos.img Co-Authored-By: Claude Fable 5 --- flake.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/flake.nix b/flake.nix index 63296c0..3aa61e9 100644 --- a/flake.nix +++ b/flake.nix @@ -331,6 +331,34 @@ diskSize = "auto"; }; + # BATM3 (OptiPlex 9030 AIO board-swap) installed image, dd-able to + # its SATA drive. Unlike the douro/sintra images, this one grows + # itself: growPartition expands the root partition to fill whatever + # drive it lands on (16GB today) at first boot and autoResize + # stretches the ext4 to match — no manual parted/resize2fs step + # after flashing, and all the drive's headroom is available to the + # nix store from day one (cf. #55). Image-only override: once + # grown, subsequent nixos-rebuilds against plain batm3-installed + # are unaffected. + disk-image-batm3 = + let + cfg = self.nixosConfigurations.batm3-installed.extendModules { + modules = [ + { + boot.growPartition = true; + fileSystems."/".autoResize = true; + } + ]; + }; + in + import (nixpkgs + "/nixos/lib/make-disk-image.nix") { + inherit pkgs lib; + config = cfg.config; + format = "raw"; + partitionTableType = "efi"; + diskSize = "auto"; + }; + # USB-bootable Sintra image with DISTINCT partition labels # (nixos-usb / ESP-USB) so the stick can be booted on a Sintra whose # eMMC already holds a nixos/ESP-labelled install without a by-label