Skip to content

feat: add caching for Nix store in GitHub Actions workflow #2

feat: add caching for Nix store in GitHub Actions workflow

feat: add caching for Nix store in GitHub Actions workflow #2

Workflow file for this run

name: Test NixOS Config
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
host:
- nixos-vm
- work-vm
steps:
- uses: actions/checkout@v4
- name: Set up Nix
uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
experimental-features = nix-command flakes
nix_path: nixpkgs=channel:nixos-unstable
- name: Cache Nix store
uses: actions/cache@v2
with:
path: /nix/store
key: ${{ runner.os }}-nix-${{ hashFiles('**/flake.lock') }}
restore-keys: |
${{ runner.os }}-nix-
- name: Test Nix Flake
run: |
nix flake check
- name: Build NixOS configuration for ${{ matrix.system }}
run: |
nix build .#nixosConfigurations.${{ matrix.system }}.config.system.build.vm
- name: Run NixOS tests for ${{ matrix.system }}
run: |
./result/bin/run-nixos-vm