Archived
Wrap auto-install.sh in a nix-shell shebang for its required tools
Check NixOS configurations / eval-hosts (pull_request) Successful in 10m20s
Check NixOS configurations / eval-hosts (pull_request) Successful in 10m20s
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.
This commit is contained in:
@@ -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 -eux
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|||||||
Reference in New Issue
Block a user