name: Nix flake
on:
push:
branches: [ "main" ]
paths:
- "src/**"
- "tests/**"
- "actions/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- "build.rs"
- "flake.nix"
- "flake.lock"
- "package.nix"
- ".github/workflows/nix.yml"
pull_request:
branches: [ "main" ]
paths:
- "src/**"
- "tests/**"
- "actions/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- "build.rs"
- "flake.nix"
- "flake.lock"
- "package.nix"
- ".github/workflows/nix.yml"
workflow_dispatch:
workflow_call:
inputs:
caller-run-id:
description: >
Run ID of the calling workflow. `github.event_name` cannot be used to
detect a called run: inside a called workflow the github context is the
caller's, so it is never 'workflow_call'.
required: false
type: string
default: ""
ref:
description: >
Exact commit to check out. Empty (the normal push/PR case) uses the
triggering ref; a release caller pins its resolved release commit.
required: false
type: string
default: ""
permissions:
contents: read
concurrency:
group: nix-${{ inputs.caller-run-id || github.ref }}
cancel-in-progress: ${{ !inputs.caller-run-id }}
jobs:
flake:
name: Nix on ${{ matrix.system }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- system: x86_64-linux
os: ubuntu-24.04
evaluate: true
- system: aarch64-linux
os: ubuntu-24.04-arm
evaluate: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 with:
ref: ${{ inputs.ref }}
persist-credentials: false
- name: Install Nix
uses: cachix/install-nix-action@630ae543ea3a38a9a4166f03376c02c50f408342 with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: Check every flake output
if: matrix.evaluate
run: nix flake check --all-systems -L
- name: Build the native package
run: nix build .#kinjo -L
- name: Run the built binary
run: ./result/bin/kinjo --version