Skip to content

feat(nix): auto optimize store #367

feat(nix): auto optimize store

feat(nix): auto optimize store #367

Workflow file for this run

name: Build nix profile
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
paths:
- ".github/**"
- "**.nix"
- "flake.lock"
jobs:
build:
strategy:
fail-fast: false
matrix:
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
include:
- os: ubuntu-latest
target: home-manager
name: william
- os: ubuntu-latest
target: nixos-rebuild
name: nixos-local
- os: macos-latest
target: home-manager
name: william-alt
- os: macos-latest
target: darwin-rebuild
name: macos-local
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Insall nix
uses: cachix/install-nix-action@V27
with:
install_url: https://releases.nixos.org/nix/nix-2.18.2/install
extra_nix_config: |
accept-flake-config = true
- name: Check Nix flake inputs
uses: DeterminateSystems/flake-checker-action@v8
- name: Github actions built-in cache
uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Setup cachix
uses: cachix/cachix-action@v15
with:
name: williamhsieh
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
skipPush: ${{ github.ref != 'refs/heads/master' }}
- name: Build target
run: |
set -o pipefail
nix run .#${{ matrix.target }} build --fallback --show-trace -v --log-format raw -- \
--flake .#${{ matrix.name }} > >(tee /tmp/nix-build-out.log) 2> >(tee /tmp/nix-build-err.log >&2)
- name: Output build failure
if: failure()
run: |
drv=$(grep "For full logs, run" /tmp/nix-build-err.log | grep -oE "/nix/store/.*.drv")
nix log $drv
echo $drv
exit 1