From b46424343f7400f63bda3592d9e3880ef13dc058 Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Wed, 22 Jul 2026 02:44:49 +0000 Subject: [PATCH] Wrap auto-install.sh in a nix-shell shebang for its required tools Running the script standalone (its whole point per the last commit) failed with "disko: command not found" -- jq/disko/nixos-install are only guaranteed present via the built installer image's environment.systemPackages, not on a plain checkout. Added a #!/usr/bin/env nix-shell / #!nix-shell -i bash -p jq disko nixos-install-tools shebang instead of a per-tool fallback: disko's own generated scripts already hardcode absolute Nix store paths for everything they shell out to internally (parted/sgdisk/mkfs.*/zfs/... confirmed by inspecting a generated system.build.formatScript earlier), so these three are the only genuinely external dependencies the script itself has. This is a fast no-op on the built installer image (already has all three) and what makes it also work standalone. Quick syntax + shellcheck pass only this round (bash -n, shellcheck with a `shellcheck shell=bash` directive since it doesn't recognize nix-shell shebangs natively) -- skipping the full codex-maintenance.sh sweep per request, to get this out for a real hardware test. --- scripts/installer/auto-install.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/installer/auto-install.sh b/scripts/installer/auto-install.sh index f35f38b..0dab81f 100755 --- a/scripts/installer/auto-install.sh +++ b/scripts/installer/auto-install.sh @@ -1,4 +1,17 @@ -#!/usr/bin/env bash +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p jq disko nixos-install-tools +# shellcheck shell=bash +# The only genuinely external tools this script calls directly: `jq` +# (parsing the `nix eval` host list) and `disko`/`nixos-install` (the +# install itself). Everything disko shells out to internally +# (parted/sgdisk/mkfs.*/zfs/...) is self-contained -- disko's own +# generated scripts hardcode absolute Nix store paths for those, they +# don't rely on this script's PATH at all (confirmed by inspecting a +# generated system.build.formatScript). The built installer image +# (modules/installer/common.nix) already has all three in +# environment.systemPackages, so this nix-shell wrapper is a fast no-op +# there; it's what makes the script also work standalone (e.g. run +# directly from a checkout on a stock ISO), where they aren't. set -eux set -euo pipefail -- 2.54.0