kinjo 0.3.8

Kinjo: mDNS TUI and commands launch for local network services
Documentation
name: Nix flake

# Evaluate every flake output and build the package natively on both supported
# Linux architectures. Source/build-script changes are included because Cargo
# CI cannot reproduce Nix sandbox and closure failures.

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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
        with:
          ref: ${{ inputs.ref }}
          persist-credentials: false

      - name: Install Nix
        uses: cachix/install-nix-action@630ae543ea3a38a9a4166f03376c02c50f408342 # v31.11.0
        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