name: Nix

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  build-flake:
    name: Build flake (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]

    steps:
      - uses: actions/checkout@v4

      - uses: cachix/install-nix-action@v31
        with:
          extra_nix_config: |
            experimental-features = nix-command flakes

      - name: Build flake
        run: nix build . --print-build-logs
