2025-01-08 21:35:09 -05:00
|
|
|
name: build and cache random stuff
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
jobs:
|
2025-01-19 19:54:35 -05:00
|
|
|
build-machines:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
machine:
|
|
|
|
- chunk
|
|
|
|
- ytnix
|
|
|
|
- titan
|
2025-01-19 20:08:27 -05:00
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-19 20:08:27 -05:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
continue-on-error: true
|
|
|
|
steps:
|
2025-01-19 21:05:49 -05:00
|
|
|
- name: Maximize build disk space
|
|
|
|
uses: easimon/maximize-build-space@v10
|
|
|
|
with:
|
2025-01-19 21:16:55 -05:00
|
|
|
overprovision-lvm: true
|
2025-01-19 21:05:49 -05:00
|
|
|
swap-size-mb: 1024
|
|
|
|
remove-dotnet: 'true'
|
|
|
|
remove-android: 'true'
|
|
|
|
remove-haskell: 'true'
|
|
|
|
remove-codeql: 'true'
|
|
|
|
remove-docker-images: 'true'
|
2025-01-19 21:16:55 -05:00
|
|
|
build-mount-path: /nix
|
2025-01-19 21:20:48 -05:00
|
|
|
build-mount-path-ownership: 'root:root'
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-20 02:35:46 -05:00
|
|
|
- uses: nixbuild/nix-quick-install-action@master
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-20 02:35:46 -05:00
|
|
|
- name: Sync repository
|
|
|
|
uses: actions/checkout@v4
|
2025-01-19 20:08:27 -05:00
|
|
|
with:
|
2025-01-20 02:35:46 -05:00
|
|
|
persist-credentials: false
|
2025-01-20 01:57:06 -05:00
|
|
|
|
|
|
|
- uses: cachix/cachix-action@v14
|
|
|
|
with:
|
|
|
|
name: cything
|
|
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
|
|
useDaemon: false
|
2025-01-20 02:09:16 -05:00
|
|
|
installCommand: nix profile install nixpkgs#cachix
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-20 02:35:46 -05:00
|
|
|
- name: Setup Attic cache
|
|
|
|
uses: ryanccn/attic-action@v0
|
2025-01-19 20:08:27 -05:00
|
|
|
with:
|
2025-01-20 02:35:46 -05:00
|
|
|
endpoint: ${{ vars.ATTIC_ENDPOINT }}
|
|
|
|
cache: ${{ vars.ATTIC_CACHE }}
|
|
|
|
token: ${{ secrets.ATTIC_TOKEN }}
|
|
|
|
|
|
|
|
- name: Restore and cache Nix store
|
|
|
|
uses: nix-community/cache-nix-action@v5.1.0
|
|
|
|
with:
|
|
|
|
# restore and save a cache using this key
|
|
|
|
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }}
|
|
|
|
# if there's no cache hit, restore a cache by this prefix
|
|
|
|
restore-prefixes-first-match: nix-${{ runner.os }}-
|
|
|
|
# do purge caches
|
|
|
|
purge: true
|
|
|
|
# purge all versions of the cache
|
|
|
|
purge-prefixes: nix-${{ runner.os }}-
|
|
|
|
# created more than this number of seconds ago relative to the start of the `Post Restore` phase
|
|
|
|
purge-last-accessed: 86400
|
|
|
|
# except the version with the `primary-key`, if it exists
|
|
|
|
purge-primary-key: never
|
|
|
|
# always save the cache
|
|
|
|
save-always: true
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-19 20:08:27 -05:00
|
|
|
- run: nix build -L --accept-flake-config .#nixosConfigurations.${{ matrix.machine }}.config.system.build.toplevel
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-19 20:08:27 -05:00
|
|
|
build-homes:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2025-01-19 19:54:35 -05:00
|
|
|
home:
|
|
|
|
- yt@ytnix
|
|
|
|
- yt@chunk
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
|
|
|
# - macos-latest
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-19 19:54:35 -05:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
continue-on-error: true
|
|
|
|
steps:
|
2025-01-19 21:05:49 -05:00
|
|
|
- name: Maximize build disk space
|
|
|
|
uses: easimon/maximize-build-space@v10
|
|
|
|
with:
|
2025-01-19 21:16:55 -05:00
|
|
|
overprovision-lvm: true
|
2025-01-19 21:05:49 -05:00
|
|
|
swap-size-mb: 1024
|
|
|
|
remove-dotnet: 'true'
|
|
|
|
remove-android: 'true'
|
|
|
|
remove-haskell: 'true'
|
|
|
|
remove-codeql: 'true'
|
|
|
|
remove-docker-images: 'true'
|
2025-01-19 21:16:55 -05:00
|
|
|
build-mount-path: /nix
|
2025-01-19 21:20:48 -05:00
|
|
|
build-mount-path-ownership: 'root:root'
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-20 02:35:46 -05:00
|
|
|
- uses: nixbuild/nix-quick-install-action@master
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-20 02:35:46 -05:00
|
|
|
- name: Sync repository
|
|
|
|
uses: actions/checkout@v4
|
2025-01-19 19:54:35 -05:00
|
|
|
with:
|
2025-01-20 02:35:46 -05:00
|
|
|
persist-credentials: false
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-20 01:48:35 -05:00
|
|
|
- uses: cachix/cachix-action@v14
|
|
|
|
with:
|
|
|
|
name: cything
|
|
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
|
|
useDaemon: false
|
2025-01-20 02:09:16 -05:00
|
|
|
installCommand: nix profile install nixpkgs#cachix
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-20 02:35:46 -05:00
|
|
|
- name: Setup Attic cache
|
|
|
|
uses: ryanccn/attic-action@v0
|
2025-01-19 19:54:35 -05:00
|
|
|
with:
|
2025-01-20 02:35:46 -05:00
|
|
|
endpoint: ${{ vars.ATTIC_ENDPOINT }}
|
|
|
|
cache: ${{ vars.ATTIC_CACHE }}
|
|
|
|
token: ${{ secrets.ATTIC_TOKEN }}
|
|
|
|
|
|
|
|
- name: Restore and cache Nix store
|
|
|
|
uses: nix-community/cache-nix-action@v5.1.0
|
|
|
|
with:
|
|
|
|
# restore and save a cache using this key
|
|
|
|
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }}
|
|
|
|
# if there's no cache hit, restore a cache by this prefix
|
|
|
|
restore-prefixes-first-match: nix-${{ runner.os }}-
|
|
|
|
# do purge caches
|
|
|
|
purge: true
|
|
|
|
# purge all versions of the cache
|
|
|
|
purge-prefixes: nix-${{ runner.os }}-
|
|
|
|
# created more than this number of seconds ago relative to the start of the `Post Restore` phase
|
|
|
|
purge-last-accessed: 86400
|
|
|
|
# except the version with the `primary-key`, if it exists
|
|
|
|
purge-primary-key: never
|
|
|
|
# always save the cache
|
|
|
|
save-always: true
|
2025-01-20 01:57:06 -05:00
|
|
|
|
2025-01-19 20:08:27 -05:00
|
|
|
- run: nix build -L --accept-flake-config .#homeConfigurations."${{ matrix.home }}".activationPackage
|