Theming System #37
Workflow file for this run
This file contains hidden or 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
| name: "Test NixOS Configuration" | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| basic-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Nix | |
| uses: cachix/install-nix-action@v25 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| extra_nix_config: | | |
| experimental-features = nix-command flakes | |
| access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
| - name: Prepare /usr/share/wallpaper and update flake.lock hash/timestamp | |
| run: | | |
| sudo mkdir -p /usr/share/wallpaper | |
| echo "dummy" | sudo tee /usr/share/wallpaper/dummy.jpg | |
| echo "nix hash path output:" | |
| nix hash path /usr/share/wallpaper | |
| HASH=$(nix hash path /usr/share/wallpaper) | |
| echo "Extracted HASH: $HASH" | |
| NOW=$(stat -c %Y /usr/share/wallpaper) | |
| echo "Calculated lastModified: $NOW" | |
| echo "Before edit:" | |
| awk '/"wallpapers": \{/ {p=1} p; /}/ && p {p=0}' flake.lock > wallpapers_block.tmp | |
| cat wallpapers_block.tmp | |
| if [ -z "$HASH" ]; then echo "ERROR: HASH is empty!"; exit 1; fi | |
| echo "DEBUG: wallpapers_block.tmp contents before lastModified edit:" | |
| cat wallpapers_block.tmp | |
| sed -i 's|"lastModified": [0-9]\+,|"lastModified": '"$NOW"',|' wallpapers_block.tmp | |
| sed -i 's|"lastModified": [0-9]\+$|"lastModified": '"$NOW"'|' wallpapers_block.tmp | |
| sed -i 's|"narHash": "[^"]*"|"narHash": "'"$HASH"'"|' wallpapers_block.tmp | |
| echo "Modified wallpapers block:" | |
| cat wallpapers_block.tmp | |
| perl -0777 -i -pe 's|("wallpapers":\s*\{[\s\S]*?\}\s*)|do { local $/; open my $fh, "<", "wallpapers_block.tmp"; <$fh> }|e' flake.lock | |
| echo "After edit:" | |
| awk '/"wallpapers": \{/ {p=1} p; /}/ && p {p=0}' flake.lock | |
| BLOCK=$(awk '/"wallpapers": \{/ {p=1} p; /}/ && p {p=0}' flake.lock) | |
| if [ -z "$BLOCK" ]; then echo "ERROR: wallpapers block is empty after edit!"; exit 1; fi | |
| rm wallpapers_block.tmp | |
| - name: Check flake syntax | |
| run: nix flake check --verbose | |
| - name: Evaluate NixOS configuration | |
| run: | | |
| nix eval .#nixosConfigurations.centaur.config.system.build.toplevel.drvPath \ | |
| --verbose | |
| - name: Check for common issues | |
| run: | | |
| echo "Checking for common configuration issues..." | |
| # Check if all imports exist | |
| echo "Verifying all imports are accessible..." | |
| nix eval .#nixosConfigurations.centaur.options --apply 'x: "imports-ok"' || echo "Import check failed" | |
| # Check if home-manager is properly configured | |
| echo "Checking home-manager integration..." | |
| nix eval .#nixosConfigurations.centaur.config.home-manager --apply 'x: "hm-ok"' || echo "Home-manager not configured" | |
| echo "Basic checks completed!" | |
| dry-build: | |
| runs-on: ubuntu-latest | |
| needs: basic-check | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Nix | |
| uses: cachix/install-nix-action@v25 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| extra_nix_config: | | |
| experimental-features = nix-command flakes | |
| access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
| - name: Dry build NixOS configuration | |
| run: | | |
| nix build .#nixosConfigurations.centaur.config.system.build.toplevel \ | |
| --dry-run \ | |
| --verbose |