Skip to content

Commit ab90aee

Browse files
committed
cicd: starts using nix flake to manage rust cicd dependencies
1 parent 5afee85 commit ab90aee

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/rust_ci.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,30 @@ jobs:
3838
with:
3939
submodules: recursive
4040

41-
- name: Setup Rust
42-
uses: dtolnay/rust-toolchain@v1
41+
- name: Cache Nix Store
42+
uses: actions/cache@v3
4343
with:
44-
target: riscv32imc-unknown-none-elf
45-
toolchain: stable
46-
components: rust-src, rustfmt, clippy
44+
path: /nix/store
45+
key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }}
46+
restore-keys: |
47+
nix-${{ runner.os }}-
4748
48-
- name: Enable caching
49-
uses: Swatinem/rust-cache@v2
49+
- name: Install Nix
50+
uses: cachix/install-nix-action@v27
51+
with:
52+
extra_nix_config: |
53+
experimental-features = nix-command flakes
54+
keep-outputs = true
55+
keep-derivations = true
5056
51-
- name: Run command
57+
- name: Use Nix shell
5258
run: |
59+
nix develop --command bash -c '
5360
if [[ -n "${{ matrix.action.package }}" ]]; then
5461
cargo ${{ matrix.action.command }} --package ${{ matrix.action.package }} ${{ matrix.action.args }}
5562
elif [[ -n "${{ matrix.action.directory }}" ]]; then
5663
cd ${{ matrix.action.directory }} && cargo ${{ matrix.action.command }} ${{ matrix.action.args }}
5764
else
5865
cargo ${{ matrix.action.command }} ${{ matrix.action.args }}
5966
fi
67+
'

0 commit comments

Comments
 (0)