Build Nix envs #812
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: Build Nix envs | |
| on: | |
| pull_request: | |
| paths: | |
| - '**' | |
| - '!**.md' | |
| push: | |
| paths: | |
| - '**' | |
| - '!**.md' | |
| schedule: | |
| - cron: '0 0 * * 0' # Every Sunday at midnight UTC | |
| jobs: | |
| build-macos-env: | |
| name: Build/cache macOS Nix env | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@v22 | |
| - name: Setup Cachix | |
| uses: cachix/cachix-action@v17 | |
| with: | |
| name: malo | |
| signingKey: ${{ secrets.CACHIX_SIGNING_KEY }} | |
| - name: If scheduled, update inputs | |
| if: ${{ github.event_name == 'schedule' && success() }} | |
| run: | | |
| nix flake update | |
| - name: Build and switch to nix-darwin env | |
| run: | | |
| # Prevent conflict between Cachix installed by workflow and the one installed in the config | |
| nix-env --set-flag priority 1 cachix | |
| # Rename files that conflict with nix-darwin activation | |
| sudo mv /etc/nix/nix.custom.conf /etc/nix/nix.custom.conf.before-nix-darwin || true | |
| sudo mv /etc/zshenv /etc/zshenv.before-nix-darwin || true | |
| # Build and switch to config | |
| nix build .#darwinConfigurations.githubCI.system | |
| sudo ./result/sw/bin/darwin-rebuild switch --flake .#githubCI | |
| - name: If scheduled, push commit with updated inputs | |
| if: ${{ github.event_name == 'schedule' && success() }} | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git aa | |
| git -c commit.gpgSign=false commit -m "Update inputs" | |
| git push | |
| build-linux-env: | |
| name: Build/cache Linux Nix env | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@v22 | |
| - name: Setup Cachix | |
| uses: cachix/cachix-action@v17 | |
| with: | |
| name: malo | |
| signingKey: ${{ secrets.CACHIX_SIGNING_KEY }} | |
| useDaemon: false | |
| - name: Build and switch to home-manager env | |
| run: | | |
| # Prevent conflict between Cachix installed by workflow and the one installed in the config | |
| nix-env --set-flag priority 1 cachix | |
| # Build and switch to home-manager env | |
| nix build .#homeConfigurations.runner.activationPackage; ./result/activate |