NixOS/.github/workflows/build-schemes.yml

84 lines
2.6 KiB
YAML

name: Build All Color Schemes
on:
push:
paths:
- 'config/schemes.nix'
- 'config/scheme-utils.nix'
workflow_dispatch:
jobs:
build-schemes:
runs-on: nixos
env:
HOSTNAME: server
steps:
- uses: actions/checkout@v4
- name: Setup Nix
uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Get available schemes
id: schemes
run: |
SCHEMES=$(nix eval --raw --expr '
let
pkgs = import <nixpkgs> {};
inputs = {};
utils = import ./scripts/scheme-utils.nix { inherit pkgs inputs; };
in
builtins.concatStringsSep " " utils.availableSchemes
')
echo "schemes=$SCHEMES" >> $GITHUB_OUTPUT
echo "Available schemes: $SCHEMES"
- name: Build all schemes
run: |
for scheme in ${{ steps.schemes.outputs.schemes }}; do
echo "Building scheme: $scheme"
nix build .#nixosConfigurations.${HOSTNAME}.config.system.build.toplevel \
--override-input stylix-scheme $scheme \
--out-link ./result-$scheme &
done
wait
echo "All schemes built successfully!"
- name: Configure Attic cache
run: |
# Configure attic client to use your cache server
attic login servidos https://cache.servidos.lat ${{ secrets.ATTIC_TOKEN }}
- name: Push schemes to cache
run: |
echo "Pushing all scheme builds to cache..."
# Push all built derivations to cache
if ls result* 1> /dev/null 2>&1; then
attic push servidos:nixos result*
fi
# Push each scheme build individually for better cache granularity
for scheme in ${{ steps.schemes.outputs.schemes }}; do
echo "Pushing scheme $scheme to cache..."
nix build .#nixosConfigurations.${HOSTNAME}.config.system.build.toplevel \
--override-input stylix-scheme $scheme \
--print-out-paths | attic push servidos:nixos --stdin
done
echo "All schemes pushed to cache successfully!"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: nixos-configurations
path: ./result-*
retention-days: 7
- name: Summary
run: |
echo "✅ Color scheme builds completed successfully!"
echo "- Built all ${{ steps.schemes.outputs.schemes }} schemes"
echo "- Pushed all builds to Atticd cache"
echo "- Uploaded artifacts for backup"