From c04ef106a38ae39203b592a513255f4023160811 Mon Sep 17 00:00:00 2001 From: MichaelFisher1997 Date: Sat, 28 Feb 2026 16:36:42 +0000 Subject: [PATCH] fix: install nix tooling in bootstrap workflow when missing --- .gitea/workflows/kubeadm-bootstrap.yml | 37 +++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/kubeadm-bootstrap.yml b/.gitea/workflows/kubeadm-bootstrap.yml index 7da5ae2..e2f85cb 100644 --- a/.gitea/workflows/kubeadm-bootstrap.yml +++ b/.gitea/workflows/kubeadm-bootstrap.yml @@ -107,13 +107,42 @@ jobs: - name: Validate nix installation run: | - if [ ! -x /nix/var/nix/profiles/default/bin/nix ]; then - echo "Nix not found at /nix/var/nix/profiles/default/bin/nix" - exit 1 + if [ -x /nix/var/nix/profiles/default/bin/nix ]; then + /nix/var/nix/profiles/default/bin/nix --version + exit 0 fi + if command -v nix >/dev/null 2>&1; then + nix --version + exit 0 + fi + + echo "Nix missing; installing no-daemon Nix for this runner job" + sh <(curl -L https://nixos.org/nix/install) --no-daemon + + if [ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then + . "$HOME/.nix-profile/etc/profile.d/nix.sh" + fi + + nix --version + + - name: Install nixos-rebuild tool + env: + NIX_CONFIG: experimental-features = nix-command flakes + run: | + if [ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then + . "$HOME/.nix-profile/etc/profile.d/nix.sh" + fi + + nix profile install nixpkgs#nixos-rebuild + - name: Run cluster rebuild and bootstrap env: - PATH: /nix/var/nix/profiles/default/bin:${{ env.PATH }} + NIX_CONFIG: experimental-features = nix-command flakes + PATH: $HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:${{ env.PATH }} run: | + if [ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then + . "$HOME/.nix-profile/etc/profile.d/nix.sh" + fi + ./nixos/kubeadm/scripts/rebuild-and-bootstrap.sh