Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/actions/setup-nix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,17 @@ runs:
paths: |
~/.cache/nix
/nix

# The restore runs as root (it has to, for /nix) and extracts absolute
# paths, so ~/.cache is created owned by root. cache-nix-action fixes the
# permissions of ~/.cache/nix itself, not of its parent, and anything that
# creates a directory under ~/.cache then fails with AccessDenied. Zig is
# the one that bit us, with ~/.cache/zig.
- name: Fix ownership of the cache directory
if: ${{ inputs.cache == 'true' }}
shell: bash
run: |
set -euo pipefail
if [ -d "$HOME/.cache" ] && [ ! -w "$HOME/.cache" ]; then
sudo chown "$(id -u):$(id -g)" "$HOME/.cache"
fi
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
- name: Check the devshell evaluates
run: nix develop .#dev --command nix --version

# Guards the restore, which extracts as root and would otherwise leave
# ~/.cache unwritable for tools that create a cache there.
- name: Check the user cache is writable
run: mkdir -p "$HOME/.cache/setup-nix-smoke" && rmdir "$HOME/.cache/setup-nix-smoke"

- name: Report cache
env:
CACHE_HIT: ${{ steps.nix.outputs.cache-hit }}
Expand Down
Loading