chore(flake.lock): update #134
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
# Source : https://github.com/tlvince/nixos-config/blob/master/.github/workflows/build.yml | |
name: Build | |
on: | |
pull_request: | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash -euo pipefail {0} | |
jobs: | |
build: | |
env: | |
PR_JOB_SUMMARY: pr-job-summary | |
NIX_GITHUB_PRIVATE_USERNAME: | |
NIX_GITHUB_PRIVATE_PASSWORD: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
pull-requests: write | |
strategy: | |
matrix: | |
host: | |
- framework | |
- t14s | |
fail-fast: false | |
steps: | |
- name: Free up disk space | |
uses: AdityaGarg8/remove-unwanted-software@8831c82abf29b34eb2caac48d5f999ecfc0d8eef | |
with: | |
remove-android: true | |
remove-cached-tools: true | |
remove-codeql: true | |
remove-docker-images: true | |
remove-dotnet: true | |
remove-haskell: true | |
remove-large-packages: true | |
remove-swapfile: true | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d # v16 | |
- name: Set up GitHub actions cache | |
uses: DeterminateSystems/magic-nix-cache-action@87b14cf437d03d37989d87f0fa5ce4f5dc1a330b # v8 | |
- name: Set up public cache | |
uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15 | |
with: | |
name: cterence-nixfiles | |
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
- name: Build | |
run: | | |
sudo systemctl set-environment NIX_GITHUB_PRIVATE_USERNAME=${{ github.repository_owner }} | |
sudo systemctl set-environment NIX_GITHUB_PRIVATE_PASSWORD=${{ secrets.GH_TOKEN_FOR_UPDATES }} | |
sudo systemctl daemon-reload && sudo systemctl restart nix-daemon | |
OUT_PATH="$(nix build .#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel --print-out-paths --access-tokens github.com=${{ secrets.GH_TOKEN_FOR_UPDATES }})" | |
echo -e "\x1b[32;1mSuccessfully built .#nixosConfigurations.${{ matrix.host }}\x1b[0m" | |
echo -e "## Build ${{ matrix.host }}\n\`$OUT_PATH\`" | tee -a "$GITHUB_STEP_SUMMARY" "${RUNNER_TEMP}/${PR_JOB_SUMMARY}" >/dev/null | |
- name: Diff closures | |
if: github.event_name == 'pull_request' | |
run: | | |
sudo systemctl set-environment NIX_GITHUB_PRIVATE_USERNAME=${{ github.repository_owner }} | |
sudo systemctl set-environment NIX_GITHUB_PRIVATE_PASSWORD=${{ secrets.GH_TOKEN_FOR_UPDATES }} | |
sudo systemctl daemon-reload && sudo systemctl restart nix-daemon | |
HOST_DRV="nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel" | |
PREV_FLAKE="github:${GITHUB_REPOSITORY}" | |
NEXT_FLAKE="." | |
DIFF_OUTPUT="${RUNNER_TEMP}/nix-store-diff-closures-output" | |
nix store diff-closures "${PREV_FLAKE}#${HOST_DRV}" "${NEXT_FLAKE}#${HOST_DRV}" --access-tokens github.com=${{ secrets.GH_TOKEN_FOR_UPDATES }} | tee "$DIFF_OUTPUT" | |
[[ -s "$DIFF_OUTPUT" ]] && sed -i 's/\x1b\[[0-9;]*m//g' "$DIFF_OUTPUT" || echo "No changes found" | tee "$DIFF_OUTPUT" | |
echo -e "## Closures difference\n\`\`\`\n$(<$DIFF_OUTPUT)\n\`\`\`" | tee -a "$GITHUB_STEP_SUMMARY" "${RUNNER_TEMP}/${PR_JOB_SUMMARY}" >/dev/null | |
- name: Add job summary to PR | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
if: github.event_name == 'pull_request' | |
with: | |
script: | | |
const { readFile } = require('node:fs/promises') | |
const comment = require('.github/scripts/comment') | |
const header = '# ${{ matrix.host }}' | |
const body = await readFile('${{ runner.temp }}/${{ env.PR_JOB_SUMMARY }}', { encoding: 'utf8' }) | |
await comment({ github, context, header, body }) |