Skip to content

Build Nix envs

Build Nix envs #264

Workflow file for this run

name: Build Nix envs
on:
pull_request:
paths:
- '**'
- '!**.md'
push:
paths:
- '**'
- '!**.md'
schedule:
- cron: '0 0 * * 0' # Every Sunday at midnight UTC
jobs:
build-macos-env:
name: Build/cache macOS Nix env
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Nix
uses: cachix/install-nix-action@v18
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
# - name: Setup Cachix
# uses: cachix/cachix-action@v10
# with:
# name: maksar
# authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: If scheduled, update inputs
if: ${{ github.event_name == 'schedule' && success() }}
run: |
nix flake update
- name: Build and switch to nix-darwin env
run: |
# Create /run directory
echo -e "run\tprivate/var/run" | sudo tee -a /etc/synthetic.conf >/dev/null
/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t 2>/dev/null || true
# Prevent conflict between Cachix installed by workflow and the one installed in the config
# nix-env --set-flag priority 1 cachix
# Build and switch to bootstrap config
nix-channel --update
nix build .#darwinConfigurations.bootstrap.system
./result/sw/bin/darwin-rebuild switch --flake .#bootstrap
# Build and switch to full config
/run/current-system/sw/bin/zsh -c './result/sw/bin/darwin-rebuild switch --flake .#githubCI'
- name: If scheduled, push commit with updated inputs
if: ${{ github.event_name == 'schedule' && success() }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "Update inputs"
git push