fix(nix): fail fast when bootstrap is unavailable

This commit is contained in:
2026-03-26 07:56:55 +01:00
parent 0e7e23dce5
commit bc57172d92
4 changed files with 11 additions and 9 deletions

View File

@@ -1,9 +1,9 @@
post_install() { post_install() {
/usr/lib/package-manager/nix/init.sh || echo ">>> ERROR: /usr/lib/package-manager/nix/init.sh not found or not executable." /usr/lib/package-manager/nix/init.sh
} }
post_upgrade() { post_upgrade() {
/usr/lib/package-manager/nix/init.sh || echo ">>> ERROR: /usr/lib/package-manager/nix/init.sh not found or not executable." /usr/lib/package-manager/nix/init.sh
} }
post_remove() { post_remove() {

View File

@@ -3,7 +3,7 @@ set -e
case "$1" in case "$1" in
configure) configure)
/usr/lib/package-manager/nix/init.sh || echo ">>> ERROR: /usr/lib/package-manager/nix/init.sh not found or not executable." /usr/lib/package-manager/nix/init.sh
;; ;;
esac esac

View File

@@ -62,7 +62,7 @@ rm -rf \
%{buildroot}/usr/lib/package-manager/.gitkeep || true %{buildroot}/usr/lib/package-manager/.gitkeep || true
%post %post
/usr/lib/package-manager/nix/init.sh || echo ">>> ERROR: /usr/lib/package-manager/nix/init.sh not found or not executable." /usr/lib/package-manager/nix/init.sh
%postun %postun
echo ">>> package-manager removed. Nix itself was not removed." echo ">>> package-manager removed. Nix itself was not removed."

View File

@@ -37,10 +37,16 @@ fi
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
if ! command -v nix >/dev/null 2>&1; then if ! command -v nix >/dev/null 2>&1; then
if [[ -x "${FLAKE_DIR}/nix/init.sh" ]]; then if [[ -x "${FLAKE_DIR}/nix/init.sh" ]]; then
"${FLAKE_DIR}/nix/init.sh" || true "${FLAKE_DIR}/nix/init.sh"
fi fi
fi fi
if ! command -v nix >/dev/null 2>&1; then
echo "[launcher] ERROR: 'nix' binary not found on PATH after init." >&2
echo "[launcher] Nix is required to run pkgmgr (no Python fallback)." >&2
exit 1
fi
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Primary path: use Nix flake if available (with GitHub 403 retry) # Primary path: use Nix flake if available (with GitHub 403 retry)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -51,7 +57,3 @@ if declare -F run_with_github_403_retry >/dev/null; then
else else
exec nix run "${FLAKE_DIR}#pkgmgr" -- "$@" exec nix run "${FLAKE_DIR}#pkgmgr" -- "$@"
fi fi
echo "[launcher] ERROR: 'nix' binary not found on PATH after init."
echo "[launcher] Nix is required to run pkgmgr (no Python fallback)."
exit 1