2024-05-23 13:27:08 -05:00
|
|
|
name: Build NixOS (on demand)
|
2024-01-23 16:09:05 -06:00
|
|
|
|
2024-01-23 11:51:13 -06:00
|
|
|
on:
|
2024-05-23 13:27:08 -05:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
host:
|
|
|
|
description: 'host name to build'
|
|
|
|
required: true
|
|
|
|
default: 'othalan'
|
|
|
|
type: string
|
|
|
|
lockFile:
|
|
|
|
description: 'flake.lock file'
|
|
|
|
type: string
|
|
|
|
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
host:
|
|
|
|
description: 'host name to build'
|
|
|
|
required: true
|
|
|
|
default: 'othalan'
|
|
|
|
type: string
|
|
|
|
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.host }}
|
|
|
|
cancel-in-progress: true
|
2024-01-23 11:51:13 -06:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-06-14 12:17:39 -05:00
|
|
|
# # The default disk size of these runners is ~14GB
|
|
|
|
# # Cleanup the disk, see upstream discussion https://github.com/actions/runner-images/issues/2840.
|
|
|
|
# - name: Cleanup Disk Space
|
|
|
|
# run: |
|
|
|
|
# echo "Before removing files:"
|
|
|
|
# df -h
|
|
|
|
# sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
|
|
|
# sudo rm -rf /opt
|
|
|
|
# sudo rm -rf /usr/share/dotnet
|
|
|
|
# sudo rm -rf /usr/local/{lib/android,share/boost}
|
|
|
|
# sudo docker image prune --all --force
|
|
|
|
# echo "After removing files:"
|
|
|
|
# df -h
|
|
|
|
|
|
|
|
- name: Maximize build space
|
|
|
|
uses: AdityaGarg8/remove-unwanted-software@v3
|
|
|
|
with:
|
|
|
|
remove-android: 'true'
|
|
|
|
remove-dotnet: 'true'
|
|
|
|
remove-haskell: 'true'
|
|
|
|
remove-codeql: 'true'
|
|
|
|
remove-docker-images: 'true'
|
|
|
|
remove-large-packages: 'true'
|
|
|
|
remove-cached-tools: 'true'
|
|
|
|
remove-swapfile: 'true'
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Build
|
2024-06-13 14:29:07 -05:00
|
|
|
run: |
|
2024-06-14 12:17:39 -05:00
|
|
|
echo "Free space:"
|
2024-06-13 14:29:07 -05:00
|
|
|
df -h
|
2024-01-23 11:51:13 -06:00
|
|
|
- uses: actions/checkout@v4
|
2024-05-23 13:27:08 -05:00
|
|
|
|
|
|
|
- uses: DeterminateSystems/nix-installer-action@main
|
2024-06-14 12:36:32 -05:00
|
|
|
- uses: DeterminateSystems/magic-nix-cache-action@v7
|
2024-02-19 14:16:00 -06:00
|
|
|
|
2024-01-23 11:51:13 -06:00
|
|
|
- uses: cachix/cachix-action@v14
|
|
|
|
with:
|
|
|
|
name: daylin
|
|
|
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
2024-02-19 14:16:00 -06:00
|
|
|
|
2024-05-23 13:27:08 -05:00
|
|
|
- name: write lock file
|
|
|
|
if: "${{ inputs.lockFile != '' }}"
|
|
|
|
run: |
|
|
|
|
echo '${{ inputs.lockFile }}' > flake.lock
|
|
|
|
git diff
|
|
|
|
|
2024-01-30 13:40:15 -06:00
|
|
|
- name: Build
|
|
|
|
run: |
|
2024-05-23 13:27:08 -05:00
|
|
|
nix run . --accept-flake-config -- cache --host "${{ inputs.host }}" --flake .
|