Chris Marchesi c3b44020f4 nix: add GitHub Actions workflow
This adds a nix workflow that does the following:

* Checks to see if the Zig cache fixed derivation needs its hash
  updated. It does this by downloading a new cache, calculating the
  hash, and comparing it against what has already been set. If the hash
  is different, the workflow fails.
* Runs a Nix build if the hash is OK, testing the build of
  packages.ghostty (using "nix build .")

The cache workflow we use in the build job comes from:
  https://github.com/DeterminateSystems/magic-nix-cache-action/

Fixes #937.
2023-11-24 17:07:55 -08:00

31 lines
887 B
YAML

on: [push, pull_request]
name: Nix
jobs:
check-zig-cache-hash:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Nix
uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Check Zig cache hash
run: nix develop -c ./nix/build-support/check-zig-cache-hash.sh
build:
needs: check-zig-cache-hash
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Nix
uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Setup Nix cache
uses: DeterminateSystems/magic-nix-cache-action@main
with:
diagnostic-endpoint: "" # disable telemetry
- name: Run build
run: nix build .