From 8bb926d66fda7e417dfabe19f25999f959076076 Mon Sep 17 00:00:00 2001 From: centra Date: Sun, 5 Apr 2026 03:59:00 +0900 Subject: [PATCH] Source Nix before KVM workflow bootstrap --- .github/workflows/kvm-publishable-selfhosted.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/kvm-publishable-selfhosted.yml b/.github/workflows/kvm-publishable-selfhosted.yml index 5ad436e..e2d537a 100644 --- a/.github/workflows/kvm-publishable-selfhosted.yml +++ b/.github/workflows/kvm-publishable-selfhosted.yml @@ -15,14 +15,24 @@ jobs: - name: Ensure Nix Is Available run: | set -euo pipefail - if ! command -v nix >/dev/null 2>&1; then - curl -L https://nixos.org/nix/install | sh -s -- --no-daemon - fi + export PATH="/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:$HOME/.nix-profile/bin:$PATH" if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh elif [[ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then . "$HOME/.nix-profile/etc/profile.d/nix.sh" fi + if ! command -v nix >/dev/null 2>&1; then + if ! command -v xz >/dev/null 2>&1; then + echo "Nix is not on PATH and xz is unavailable for bootstrap" + exit 1 + fi + curl -L https://nixos.org/nix/install | sh -s -- --no-daemon + if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + elif [[ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then + . "$HOME/.nix-profile/etc/profile.d/nix.sh" + fi + fi mkdir -p "$HOME/.config/nix" printf '%s\n' 'experimental-features = nix-command flakes' > "$HOME/.config/nix/nix.conf" nix --version