build-systems.yaml (2975B)
1 name: Nix Flake actions 2 3 permissions: 4 contents: read 5 6 on: 7 workflow_dispatch: {} 8 pull_request: 9 push: 10 branches: 11 - main 12 concurrency: 13 group: ${{ github.workflow }}-${{ github.ref }} 14 cancel-in-progress: true 15 16 jobs: 17 nix-matrix: 18 runs-on: ubuntu-latest 19 outputs: 20 matrix: ${{ steps.set-matrix.outputs.matrix }} 21 steps: 22 - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 23 - uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # v27 24 - id: set-matrix 25 name: Generate Nix Matrix 26 run: | 27 set -Eeu 28 nix flake show --json | jq '.nixosConfigurations | to_entries | map({"name": .key})' 29 echo matrix="{\"include\": " $(nix flake show --json | jq '.nixosConfigurations | to_entries | map({"name": .key})') >> "$GITHUB_OUTPUT" "}" 30 cat $GITHUB_OUTPUT 31 32 nix-build: 33 needs: nix-matrix 34 runs-on: ubuntu-latest 35 strategy: 36 fail-fast: false # Keep running if one leg fails. 37 matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}} 38 steps: 39 - name: Maximize build space 40 uses: AdityaGarg8/remove-unwanted-software@e379ba59405864059cedd318f38b6574dffd0ef8 # v4 41 with: 42 remove-android: 'true' 43 remove-dotnet: 'true' 44 remove-haskell: 'true' 45 remove-codeql: 'true' 46 remove-docker-images: 'false' 47 remove-large-packages: 'true' 48 remove-cached-tools: 'true' 49 remove-swapfile: 'true' 50 - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 51 - uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # v27 52 - uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15 53 with: 54 name: vdemeester 55 authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 56 skipPush: ${{ github.event_name == 'pull_request' }} 57 extra_nix_config: | 58 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= 59 substituters = https://hydra.iohk.io https://cache.nixos.org/ 60 - uses: dbhi/qus/action@main 61 with: 62 targets: aarch64 63 - name: build 64 run: | 65 # FIXME temporary hack to make system build successfully 66 # I need to create dumb file for mkOutOfStoreSymlink 67 sudo mkdir -p /home/vincent/src/home/tools/emacs /home/vincent/desktop/documents 68 sudo touch /home/vincent/desktop/documents/.oath 69 # build the system 70 # FIXME: move this away from this somehow 71 BUILD_ARGS="" 72 if [[ "${{ matrix.name }}" == "demeter" || "${{ matrix.name }}" == "athena" ]]; then 73 BUILD_ARGS="${BUILD_ARGS} --option system aarch64-linux" 74 fi 75 nix build ${BUILD_ARGS} -L ".#nixosConfigurations.${{ matrix.name }}.config.system.build.toplevel"