name: nix

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  check:
    name: nix flake check
    runs-on: linux-x86_64-16cpu
    steps:
      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
      - uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31.10.6
      - run: nix flake check -L

  build:
    strategy:
      matrix:
        include:
          - target: x86_64-linux
            runner: linux-x86_64-16cpu
          - target: aarch64-linux
            runner: linux-arm64-16cpu

    name: nix build ${{ matrix.target }}
    runs-on: ${{ matrix.runner }}
    steps:
      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
      - uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31.10.6

      - name: nix build
        run: |-
          exec nix build -L .
