From 0b2bde4cb48f8c9cde39e465929e49395424a08d Mon Sep 17 00:00:00 2001 From: Typas Liao Date: Sun, 26 Apr 2026 10:33:08 +0800 Subject: [PATCH 1/2] ci(mac): fix nix cache config The original cache setup had three problems: v6 of cache-nix-action is outdated; the key hashed only init.sh, missing flake.lock which is what actually pins the nix-darwin package set; ~/.cache/nix (flake input tarballs) was not cached so nixpkgs was re-fetched every run; and the 1 GiB store cap was too small for a full nix-darwin activation, causing evictions. Raise the cap to 5 GiB and drop the now-redundant profile source since mac-nix-setup writes nix to GITHUB_PATH. Co-Authored-By: Claude --- .github/workflows/bootstrap.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml index 37b3d69..442ea57 100644 --- a/.github/workflows/bootstrap.yml +++ b/.github/workflows/bootstrap.yml @@ -57,13 +57,12 @@ jobs: - uses: ./.github/actions/mac-nix-setup with: github-token: ${{ secrets.GITHUB_TOKEN }} - - uses: nix-community/cache-nix-action@v6 + - uses: nix-community/cache-nix-action@v7 with: - primary-key: nix-${{ runner.os }}-${{ hashFiles('init.sh') }} + primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock', 'init.sh') }} restore-prefixes-first-match: nix-${{ runner.os }}- - gc-max-store-size-macos: 1073741824 + paths-macos: | + ~/.cache/nix + gc-max-store-size-macos: 5368709120 - name: bash init.sh - run: | - # shellcheck disable=SC1091 - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh - bash init.sh + run: bash init.sh From d586039d18e50e4a3637249b07a97a2d119bfcae Mon Sep 17 00:00:00 2001 From: Typas Liao Date: Sun, 26 Apr 2026 10:30:07 +0800 Subject: [PATCH 2/2] fix(mac-nix-setup): add nix bins to GITHUB_PATH Without writing to GITHUB_PATH, nix is absent from PATH in subsequent steps and post-run hooks. cache-nix-action's post-job step failed with exit 127 when calling nix --version, silently skipping the cache save. nix profile add also installs just into ~/.nix-profile/bin which was equally invisible, causing a command not found at the end of init.sh. Co-Authored-By: Claude --- .github/actions/mac-nix-setup/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/mac-nix-setup/action.yml b/.github/actions/mac-nix-setup/action.yml index 65dae39..8067194 100644 --- a/.github/actions/mac-nix-setup/action.yml +++ b/.github/actions/mac-nix-setup/action.yml @@ -29,3 +29,5 @@ runs: for f in /etc/bashrc /etc/zshrc; do test -e "$f" && sudo mv "$f" "$f.before-nix-darwin" done + echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH" + echo "$HOME/.nix-profile/bin" >> "$GITHUB_PATH"