Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cachix substituter fed by CI #183

Merged
merged 1 commit into from
Sep 17, 2023
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
27 changes: 27 additions & 0 deletions .github/composites/setup-nix/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
inputs:
githubAccessToken:
required: true
cachixAuthToken:
required: true

runs:
using: composite

steps:
- name: Install Nix
uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
## Access token to avoid triggering GitHub's rate limiting.
access-tokens = github.com=${{ inputs.githubAccessToken }}
## Accept arbitrary substituters from the flake.
accept-flake-config = true

- name: Setup Nix caches
uses: cachix/cachix-action@v12
with:
name: scd-niols-fr
## This auth token will give write access to the cache, meaning that
## everything that happens in CI will be pushed at the end of the job.
authToken: "${{ inputs.cachixAuthToken }}"
18 changes: 8 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Nix
uses: cachix/install-nix-action@v22
- name: Setup Nix
uses: ./.github/composites/setup-nix
with:
extra_nix_config: |
## Access token to avoid triggering GitHub's rate limiting.
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
cachixAuthToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Install Nix dependencies
run: |
Expand Down Expand Up @@ -332,12 +331,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Nix
uses: cachix/install-nix-action@v22
- name: Setup Nix
uses: ./.github/composites/setup-nix
with:
extra_nix_config: |
## Access token to avoid triggering GitHub's rate limiting.
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
githubAccessToken: ${{ secrets.GITHUB_TOKEN }}
cachixAuthToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Run flake checks
run: nix flake check . --print-build-logs
9 changes: 9 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,13 @@
perInput = system: flake:
if flake ? lib.${system} then { lib = flake.lib.${system}; } else { };
};

nixConfig = {
extra-trusted-substituters = [
"https://morbig.cachix.org/"
];
extra-trusted-public-keys = [
"morbig.cachix.org-1:l6jrpCfkt03SwhxnK7VNDgrnMDW9OA92BTcuZTNw60I="
];
};
}