From a461a44bcca040799c8940bd378d97641842a720 Mon Sep 17 00:00:00 2001 From: Sophie Wallace Date: Thu, 18 May 2023 16:27:18 +0100 Subject: [PATCH] use cachix instead of caching nix store on github (#71) * use cachix instead of caching nix store on github * automatically use auxtools cache in flake (if allowed by user) --- .github/workflows/linux.yml | 18 ++++-------------- flake.nix | 2 ++ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index d64319f1..6db10e82 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -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: diff --git a/flake.nix b/flake.nix index 75d1a128..427ed23d 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = {