Fix auto-install.sh to work standalone, not just baked into the image #37

Merged
beatzaplenty merged 1 commits from worktree-gui-wifi-module into main 2026-07-22 02:40:03 +00:00
Owner

Two real bugs, both hit live:

  1. Shebang: #!/run/current-system/sw/bin/bash only resolves on an
    already-activated NixOS system -- running the checked-out script
    directly (e.g. from a stock ISO, cloned repo) failed with "cannot
    execute: required file not found" on a non-NixOS box. Switched to
    #!/usr/bin/env bash, which resolves identically on NixOS
    (environment.usrbinenv's own default) and any normal Linux distro.
    Also fixed the file's missing executable bit.

  2. FLAKE_BASE_URL: previously depended on pkgs.replaceVars substituting
    a Nix-templated @lanDomain@ placeholder at build time -- meaning it
    only ever worked when baked into the built installer image, not when
    run straight from a checkout (the literal, unexpanded "@lanDomain@"
    string reached git as a bogus hostname). Replaced with LAN_DOMAIN in
    scripts/env.sh (manually kept in sync with variables.nix's lanDomain,
    same pattern as NIX_CACHE_HOST/nixCacheHost already), sourced by the
    script itself like every other script in scripts/. Dropped
    pkgs.replaceVars from modules/installer/common.nix entirely --
    scripts/env.sh is now baked into the image alongside auto-install.sh
    at a matching relative path (/etc/nixos-installer/env.sh next to
    /etc/nixos-installer/installer/auto-install.sh) so the script's own
    relative source line resolves the same way in both contexts.

loginShellInit's invocation path and docs/auto-installer.md updated to
match. Verified: shellcheck clean on both scripts, the baked files are
byte-identical to their checked-in sources (no templating left to
verify), and codex-maintenance.sh (secret grep, fmt, statix, full eval
of every host/package including the installer/pxe artifacts) passes
clean.

Two real bugs, both hit live: 1. Shebang: #!/run/current-system/sw/bin/bash only resolves on an already-activated NixOS system -- running the checked-out script directly (e.g. from a stock ISO, cloned repo) failed with "cannot execute: required file not found" on a non-NixOS box. Switched to #!/usr/bin/env bash, which resolves identically on NixOS (environment.usrbinenv's own default) and any normal Linux distro. Also fixed the file's missing executable bit. 2. FLAKE_BASE_URL: previously depended on pkgs.replaceVars substituting a Nix-templated @lanDomain@ placeholder at build time -- meaning it only ever worked when baked into the built installer image, not when run straight from a checkout (the literal, unexpanded "@lanDomain@" string reached git as a bogus hostname). Replaced with LAN_DOMAIN in scripts/env.sh (manually kept in sync with variables.nix's lanDomain, same pattern as NIX_CACHE_HOST/nixCacheHost already), sourced by the script itself like every other script in scripts/. Dropped pkgs.replaceVars from modules/installer/common.nix entirely -- scripts/env.sh is now baked into the image alongside auto-install.sh at a matching relative path (/etc/nixos-installer/env.sh next to /etc/nixos-installer/installer/auto-install.sh) so the script's own relative `source` line resolves the same way in both contexts. loginShellInit's invocation path and docs/auto-installer.md updated to match. Verified: shellcheck clean on both scripts, the baked files are byte-identical to their checked-in sources (no templating left to verify), and codex-maintenance.sh (secret grep, fmt, statix, full eval of every host/package including the installer/pxe artifacts) passes clean.
beatzaplenty added 1 commit 2026-07-22 02:39:54 +00:00
Fix auto-install.sh to work standalone, not just baked into the image
Check NixOS configurations / eval-hosts (pull_request) Successful in 11m6s
f565e9c2a1
Two real bugs, both hit live:

1. Shebang: #!/run/current-system/sw/bin/bash only resolves on an
   already-activated NixOS system -- running the checked-out script
   directly (e.g. from a stock ISO, cloned repo) failed with "cannot
   execute: required file not found" on a non-NixOS box. Switched to
   #!/usr/bin/env bash, which resolves identically on NixOS
   (environment.usrbinenv's own default) and any normal Linux distro.
   Also fixed the file's missing executable bit.

2. FLAKE_BASE_URL: previously depended on pkgs.replaceVars substituting
   a Nix-templated @lanDomain@ placeholder at build time -- meaning it
   only ever worked when baked into the built installer image, not when
   run straight from a checkout (the literal, unexpanded "@lanDomain@"
   string reached git as a bogus hostname). Replaced with LAN_DOMAIN in
   scripts/env.sh (manually kept in sync with variables.nix's lanDomain,
   same pattern as NIX_CACHE_HOST/nixCacheHost already), sourced by the
   script itself like every other script in scripts/. Dropped
   pkgs.replaceVars from modules/installer/common.nix entirely --
   scripts/env.sh is now baked into the image alongside auto-install.sh
   at a matching relative path (/etc/nixos-installer/env.sh next to
   /etc/nixos-installer/installer/auto-install.sh) so the script's own
   relative `source` line resolves the same way in both contexts.

loginShellInit's invocation path and docs/auto-installer.md updated to
match. Verified: shellcheck clean on both scripts, the baked files are
byte-identical to their checked-in sources (no templating left to
verify), and codex-maintenance.sh (secret grep, fmt, statix, full eval
of every host/package including the installer/pxe artifacts) passes
clean.
beatzaplenty merged commit 33b1d5ec79 into main 2026-07-22 02:40:03 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No labels
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: beatzaplenty/nixos#37