From f2f6ce0ec162b42cc6071c41fc64f830b6974d71 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Wed, 2 Sep 2026 14:22:53 -0400 Subject: [PATCH] sdcard image for pi --- bin/lib/cmds.nu | 7 +++++++ flake.nix | 9 +++++++++ hosts/ABOUTME.md | 2 +- modules/lib.nix | 25 +++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/bin/lib/cmds.nu b/bin/lib/cmds.nu index bfc89d9..4ed6066 100644 --- a/bin/lib/cmds.nu +++ b/bin/lib/cmds.nu @@ -315,6 +315,13 @@ export def "skyg build-iso" [] { ls -l result/iso } +# Build hl-pi1 SD card image (fully-baked, no on-device rebuild needed) +export def "skyg build-pi-sd-image" [] { + cd $REPO_ROOT + nix build .#nixosConfigurations.hl-pi1-sd-image.config.system.build.sdImage + ls -l result/sd-image +} + # Home Manager operations export def "skyg hm" [action: string@hm-actions, profile: string = "ari"] { cd $REPO_ROOT diff --git a/flake.nix b/flake.nix index ed1d457..7ef572b 100644 --- a/flake.nix +++ b/flake.nix @@ -287,6 +287,15 @@ ./hosts/hl-pi1.hardware-configuration.nix ]; }; + # Fully-baked bootable SD card image for hl-pi1 — builds the whole + # target system off-Pi (see nix.buildMachines/binfmt on fwdesk / + # hl-bigbox1) so flashing it needs no on-device rebuild. + hl-pi1-sd-image = lib.makeSdImage { + hostName = "hl-pi1"; + configuration = [ + ./hosts/hl-pi1.nix + ]; + }; hl-terra1 = lib.makeNixOs { hostName = "hl-terra1"; configuration = [ diff --git a/hosts/ABOUTME.md b/hosts/ABOUTME.md index 1edd267..48be142 100644 --- a/hosts/ABOUTME.md +++ b/hosts/ABOUTME.md @@ -28,7 +28,7 @@ hosts/ | `hl-minipc1.nix` | hl-minipc1 | Core infra: Gitea, nix-serve, Docker registry | | `hl-minipc2.nix` | hl-minipc2 | Container/media server | | `hl-minipc3.nix` | hl-minipc3 | K3s worker node | -| `hl-pi1.nix` | hl-pi1 | Raspberry Pi CM4 (aarch64) — headless server, SSH only | +| `hl-pi1.nix` | hl-pi1 | Raspberry Pi CM4 (aarch64) — headless server, SSH only. Also buildable as a bootable SD image via the `hl-pi1-sd-image` nixosConfiguration (`skyg build-pi-sd-image`) | | `hl-terra1.nix` | hl-terra1 | NFS storage + Jellyfin backup | | `iso.nix` | iso | Bootable NixOS installer image | diff --git a/modules/lib.nix b/modules/lib.nix index 4069c67..7bc4a32 100644 --- a/modules/lib.nix +++ b/modules/lib.nix @@ -131,6 +131,31 @@ in ] ++ configuration; }; + makeSdImage = + { system ? "aarch64-linux" + , hostName + , systemStateVersion ? "26.05" + , homeManagerVersion ? "26.05" + , configuration ? [ ] + }: nixpkgs.lib.nixosSystem { + specialArgs = specialArgs // { + inherit system skygUtils user; + unstablePkgs = nixpkgs-unstable.legacyPackages.${system}; + }; + inherit system; + modules = osModules ++ [ + "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" + (import ./main.nix { + inherit + user + hostName + systemStateVersion + homeManagerVersion + ; + }) + ] ++ configuration; + }; + makeDarwinModule = { system ? "x86_64-darwin" , user