Skip to content

Commit 1036e11

Browse files
committed
ci: upload nix outputs to cachix
1 parent ab56476 commit 1036e11

2 files changed

Lines changed: 42 additions & 19 deletions

File tree

‎.github/workflows/nix-ci.yml‎

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212

1313
permissions:
1414
contents: read
15-
id-token: write
1615

1716
concurrency:
1817
group: ${{ github.workflow }}-${{ github.ref }}
@@ -46,12 +45,17 @@ jobs:
4645

4746
- name: Install Nix
4847
uses: DeterminateSystems/nix-installer-action@main
49-
50-
- name: Enable Magic Nix Cache
51-
uses: DeterminateSystems/magic-nix-cache-action@main
52-
53-
- name: Build package
54-
run: nix build ".#packages.${{ matrix.target.system }}.${{ matrix.package }}" --no-link --no-update-lock-file
48+
with:
49+
extra-conf: |
50+
accept-flake-config = true
51+
52+
- name: Build and upload package
53+
env:
54+
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
55+
run: |
56+
: "${CACHIX_AUTH_TOKEN:?CACHIX_AUTH_TOKEN is required to upload to Cachix}"
57+
nix run --inputs-from . nixpkgs#cachix -- watch-exec openshell -- \
58+
nix build ".#packages.${{ matrix.target.system }}.${{ matrix.package }}" --no-link --no-update-lock-file
5559
5660
test:
5761
name: Test ${{ matrix.check }} (${{ matrix.target.system }})
@@ -88,12 +92,17 @@ jobs:
8892

8993
- name: Install Nix
9094
uses: DeterminateSystems/nix-installer-action@main
91-
92-
- name: Enable Magic Nix Cache
93-
uses: DeterminateSystems/magic-nix-cache-action@main
94-
95-
- name: Run test
96-
run: nix build ".#checks.${{ matrix.target.system }}.${{ matrix.check }}" --no-link --no-update-lock-file
95+
with:
96+
extra-conf: |
97+
accept-flake-config = true
98+
99+
- name: Run and upload test
100+
env:
101+
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
102+
run: |
103+
: "${CACHIX_AUTH_TOKEN:?CACHIX_AUTH_TOKEN is required to upload to Cachix}"
104+
nix run --inputs-from . nixpkgs#cachix -- watch-exec openshell -- \
105+
nix build ".#checks.${{ matrix.target.system }}.${{ matrix.check }}" --no-link --no-update-lock-file
97106
98107
lint:
99108
name: Lint ${{ matrix.lint }} (${{ matrix.target.system }})
@@ -131,9 +140,14 @@ jobs:
131140

132141
- name: Install Nix
133142
uses: DeterminateSystems/nix-installer-action@main
134-
135-
- name: Enable Magic Nix Cache
136-
uses: DeterminateSystems/magic-nix-cache-action@main
137-
138-
- name: Run lint
139-
run: nix build ".#checks.${{ matrix.target.system }}.${{ matrix.lint }}" --no-link --no-update-lock-file
143+
with:
144+
extra-conf: |
145+
accept-flake-config = true
146+
147+
- name: Run and upload lint
148+
env:
149+
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
150+
run: |
151+
: "${CACHIX_AUTH_TOKEN:?CACHIX_AUTH_TOKEN is required to upload to Cachix}"
152+
nix run --inputs-from . nixpkgs#cachix -- watch-exec openshell -- \
153+
nix build ".#checks.${{ matrix.target.system }}.${{ matrix.lint }}" --no-link --no-update-lock-file

‎flake.nix‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
{
55
description = "OpenShell development environment";
66

7+
nixConfig = {
8+
extra-substituters = [ "https://openshell.cachix.org" ];
9+
extra-trusted-public-keys = [
10+
"openshell.cachix.org-1:OAr5MunsfH5PZvUsfD08OtGx5RtcwdNZGJdU5FqLm5w="
11+
];
12+
};
13+
714
inputs = {
815
flake-utils.url = "github:numtide/flake-utils";
916
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@@ -105,6 +112,8 @@
105112
llvmPackages.libclang
106113
# system dependency for openshell-prover
107114
z3
115+
# caching utility
116+
cachix
108117
];
109118

110119
env = {

0 commit comments

Comments
 (0)