feat: migrate to Nix Flake build system #159
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: [push, pull_request] | |
jobs: | |
ci: | |
name: ci | |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md | |
runs-on: macos-15 | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Nix version | |
run: nix --version | |
- name: Xcode version | |
run: /Applications/Xcode_16.app/Contents/Developer/usr/bin/xcodebuild -version | |
# See ${workspace}/nix/overlays/xcode.md | |
- name: Set up Xcode in Nix store | |
run: | | |
XCODE_APP="/Applications/Xcode_16.app" | |
NIX_STORE_PATH="/nix/store/9irb2b36sn0693q7x2l554inm81vb2g6-Xcode.app" | |
HASH="sha256:e3ebfbc4f45488d6a8dd950d03da2d23a23659f490b440f5f59f8c28dbe5282e" | |
sudo cp -a $XCODE_APP $NIX_STORE_PATH | |
sudo sqlite3 /nix/var/nix/db/db.sqlite "INSERT INTO ValidPaths (path,hash,registrationTime) VALUES ('$NIX_STORE_PATH','$HASH',$(date +%s))" | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: Determine version | |
id: version | |
run: | | |
case "${GITHUB_REF}" in | |
refs/tags/*) | |
VERSION=${GITHUB_REF#refs/tags/} | |
;; | |
*) | |
VERSION=develop | |
;; | |
esac | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
echo ${VERSION} | |
- name: Build | |
run: | | |
VERSION=${{ steps.version.outputs.version }} | |
echo \"$VERSION\" > nix/utils/default/version.nix | |
nix build -v | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
path: | | |
result/*.tar.gz | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
fail_on_unmatched_files: true | |
files: | | |
result/*.tar.gz |