Skip to content

Commit

Permalink
use cachix instead of caching nix store on github (#71)
Browse files Browse the repository at this point in the history
* use cachix instead of caching nix store on github

* automatically use auxtools cache in flake (if allowed by user)
  • Loading branch information
willox authored May 18, 2023
1 parent 973be09 commit a461a44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,19 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Cache Nix store
uses: actions/cache@v3
id: nix-cache
with:
path: /tmp/nix-cache
key: nix-cache-${{ hashFiles('flake.nix') }}-${{ hashFiles('flake.lock') }}

- name: Install Nix
uses: cachix/install-nix-action@v20
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: "Import Nix store"
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: "nix-store --import < /tmp/nix-cache"
- uses: cachix/cachix-action@v12
with:
name: auxtools
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Build
run: nix build --accept-flake-config

- name: "Export Nix store"
if: "steps.nix-cache.outputs.cache-hit != 'true'"
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nix-cache"

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
nixConfig.extra-substituters = [
"https://nix-community.cachix.org"
"https://auxtools.cachix.org"
];

nixConfig.extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"auxtools.cachix.org-1:vh1xH58ZpS5hn7IPOY2fHw1F2QqMxwsdDks/bouqetI="
];

inputs = {
Expand Down

0 comments on commit a461a44

Please sign in to comment.