From cad0288d6874a58f2d6c997f4a294a58a01a488b Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Wed, 29 Oct 2025 09:57:44 -0600 Subject: [PATCH] lan login for schemes pipeline as well --- .github/workflows/build-schemes.yml | 152 ++++++++++++++-------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/.github/workflows/build-schemes.yml b/.github/workflows/build-schemes.yml index 18ad255..2cee175 100644 --- a/.github/workflows/build-schemes.yml +++ b/.github/workflows/build-schemes.yml @@ -3,8 +3,8 @@ name: Build All Color Schemes on: push: paths: - - 'config/schemes.nix' - - 'config/scheme-utils.nix' + - "config/schemes.nix" + - "config/scheme-utils.nix" workflow_dispatch: jobs: @@ -12,81 +12,81 @@ jobs: runs-on: nixos env: HOSTNAME: server - + steps: - - uses: actions/checkout@v4 - - - name: Get available schemes - id: schemes - run: | - SCHEMES=$(nix eval --raw --impure --expr ' - let - pkgs = import {}; - 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: Configure Attic cache - run: | - # Configure attic client to use your cache server - attic login servidos https://cache.servidos.lat ${{ secrets.ATTIC_TOKEN }} - - - name: Build and push all schemes - run: | - echo "Building and pushing all schemes..." - - # Store original scheme - ORIGINAL_SCHEME=$(grep -oP "scheme = schemesFile\.schemes\.\K\w+" config/stylix.nix) - echo "Original scheme: $ORIGINAL_SCHEME" - - # Build and push each scheme - for scheme in ${{ steps.schemes.outputs.schemes }}; do + - uses: actions/checkout@v4 + + - name: Get available schemes + id: schemes + run: | + SCHEMES=$(nix eval --raw --impure --expr ' + let + pkgs = import {}; + 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: Configure Attic cache + run: | + # Configure attic client to use your cache server + attic login servidos http://127.0.0.1:2343 ${{ secrets.ATTIC_TOKEN }} + + - name: Build and push all schemes + run: | + echo "Building and pushing all schemes..." + + # Store original scheme + ORIGINAL_SCHEME=$(grep -oP "scheme = schemesFile\.schemes\.\K\w+" config/stylix.nix) + echo "Original scheme: $ORIGINAL_SCHEME" + + # Build and push each scheme + for scheme in ${{ steps.schemes.outputs.schemes }}; do + echo "=========================================" + echo "Processing scheme: $scheme" + echo "=========================================" + + # Update stylix.nix to use this scheme + sed -i "s/scheme = schemesFile\.schemes\.\w\+;/scheme = schemesFile.schemes.$scheme;/" config/stylix.nix + + # Verify the change + grep "scheme = schemesFile.schemes" config/stylix.nix + + # Build the configuration + echo "Building $scheme..." + nix build .#nixosConfigurations.${HOSTNAME}.config.system.build.toplevel \ + --out-link ./result-$scheme \ + --quiet + + # Push to cache + echo "Pushing $scheme to cache..." + attic push servidos:nixos ./result-$scheme + + # Also push using print-out-paths for better cache coverage + nix build .#nixosConfigurations.${HOSTNAME}.config.system.build.toplevel \ + --print-out-paths \ + --quiet | attic push servidos:nixos --stdin + + echo "✓ Completed $scheme" + echo "" + done + + # Restore original scheme + echo "Restoring original scheme: $ORIGINAL_SCHEME" + sed -i "s/scheme = schemesFile\.schemes\.\w\+;/scheme = schemesFile.schemes.$ORIGINAL_SCHEME;/" config/stylix.nix + echo "=========================================" - echo "Processing scheme: $scheme" + echo "All schemes built and pushed successfully!" echo "=========================================" - - # Update stylix.nix to use this scheme - sed -i "s/scheme = schemesFile\.schemes\.\w\+;/scheme = schemesFile.schemes.$scheme;/" config/stylix.nix - - # Verify the change - grep "scheme = schemesFile.schemes" config/stylix.nix - - # Build the configuration - echo "Building $scheme..." - nix build .#nixosConfigurations.${HOSTNAME}.config.system.build.toplevel \ - --out-link ./result-$scheme \ - --quiet - - # Push to cache - echo "Pushing $scheme to cache..." - attic push servidos:nixos ./result-$scheme - - # Also push using print-out-paths for better cache coverage - nix build .#nixosConfigurations.${HOSTNAME}.config.system.build.toplevel \ - --print-out-paths \ - --quiet | attic push servidos:nixos --stdin - - echo "✓ Completed $scheme" + + - name: Summary + run: | + SCHEME_COUNT=$(echo "${{ steps.schemes.outputs.schemes }}" | wc -w) + echo "✅ Color scheme builds completed successfully!" + echo "- Built $SCHEME_COUNT schemes: ${{ steps.schemes.outputs.schemes }}" + echo "- Pushed all builds to Atticd cache" echo "" - done - - # Restore original scheme - echo "Restoring original scheme: $ORIGINAL_SCHEME" - sed -i "s/scheme = schemesFile\.schemes\.\w\+;/scheme = schemesFile.schemes.$ORIGINAL_SCHEME;/" config/stylix.nix - - echo "=========================================" - echo "All schemes built and pushed successfully!" - echo "=========================================" - - - name: Summary - run: | - SCHEME_COUNT=$(echo "${{ steps.schemes.outputs.schemes }}" | wc -w) - echo "✅ Color scheme builds completed successfully!" - echo "- Built $SCHEME_COUNT schemes: ${{ steps.schemes.outputs.schemes }}" - echo "- Pushed all builds to Atticd cache" - echo "" - echo "You can now switch schemes quickly without waiting for builds!" + echo "You can now switch schemes quickly without waiting for builds!"