File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : " Nix Housekeeping"
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ - dev-nix-cache
8+ workflow_dispatch : {}
9+
10+ jobs :
11+ cache-dev-shell :
12+ runs-on : ubuntu-latest
13+ permissions :
14+ contents : read
15+
16+ steps :
17+ - name : 📥 Clone repository
18+ uses : actions/checkout@v6
19+ with :
20+ repository : ${{ inputs.checkout_repo || github.repository }}
21+ ref : ${{ inputs.checkout_ref || '' }}
22+
23+ - name : ❄ Install Nix
24+ uses : DeterminateSystems/nix-installer-action@main
25+ with :
26+ extra-conf : |
27+ extra-substituters = https://graphite.cachix.org https://graphite-dev.cachix.org
28+ extra-trusted-public-keys = graphite.cachix.org-1:B7Il1yMpkquN/dXM+5GRmz+4Xmu2aaCS1GcWNfFhsOo= graphite-dev.cachix.org-1:RppXYpiV1qO2TYKTkXXGHsAEQDOB5G51b3VlrN9QmbI=
29+
30+ - name : 🔎 Check whether development shell is already in binary cache
31+ id : cache-check
32+ run : |
33+ out_path="$(nix eval --raw .#devShells.x86_64-linux.default.outPath)"
34+ if nix path-info --store https://graphite-dev.cachix.org "$out_path" &>/dev/null; then
35+ echo "cached=true" >> "$GITHUB_OUTPUT"
36+ echo "Development shell is already cached at $out_path"
37+ else
38+ echo "cached=false" >> "$GITHUB_OUTPUT"
39+ echo "Development shell is not cached"
40+ fi
41+
42+ - name : 📦 Build Nix development shell
43+ if : steps.cache-check.outputs.cached == 'false'
44+ run : nix build .#devShells.x86_64-linux.default --no-link --print-out-paths
45+
46+ - name : 📤 Push Nix development shell to binary cache
47+ if : steps.cache-check.outputs.cached == 'false'
48+ env :
49+ NIX_CACHE_AUTH_TOKEN : ${{ secrets.NIX_CACHE_AUTH_TOKEN_DEV }}
50+ run : |
51+ nix run nixpkgs#cachix -- authtoken $NIX_CACHE_AUTH_TOKEN
52+ nix build .#devShells.x86_64-linux.default --no-link --print-out-paths | nix run nixpkgs#cachix -- push graphite-dev
You can’t perform that action at this time.
0 commit comments