1name: Build
2
3on:
4 workflow_call:
5 inputs:
6 baseBranch:
7 required: true
8 type: string
9 mergedSha:
10 required: true
11 type: string
12 secrets:
13 CACHIX_AUTH_TOKEN:
14 required: true
15
16permissions: {}
17
18defaults:
19 run:
20 shell: bash
21
22jobs:
23 build:
24 strategy:
25 fail-fast: false
26 matrix:
27 include:
28 - runner: ubuntu-24.04
29 name: x86_64-linux
30 systems: x86_64-linux
31 builds: [shell, manual-nixos, lib-tests, tarball]
32 desc: shell, docs, lib, tarball
33 - runner: ubuntu-24.04-arm
34 name: aarch64-linux
35 systems: aarch64-linux
36 builds: [shell, manual-nixos, manual-nixpkgs, manual-nixpkgs-tests]
37 desc: shell, docs
38 - runner: macos-14
39 name: darwin
40 systems: aarch64-darwin x86_64-darwin
41 builds: [shell]
42 desc: shell
43 name: '${{ matrix.name }}: ${{ matrix.desc }}'
44 runs-on: ${{ matrix.runner }}
45 timeout-minutes: 60
46 steps:
47 - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
48 with:
49 sparse-checkout: .github/actions
50 - name: Checkout the merge commit
51 uses: ./.github/actions/checkout
52 with:
53 merged-as-untrusted-at: ${{ inputs.mergedSha }}
54
55 - uses: cachix/install-nix-action@9280e7aca88deada44c930f1e2c78e21c3ae3edd # v31
56 with:
57 # Sandbox is disabled on MacOS by default.
58 extra_nix_config: sandbox = true
59
60 - uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
61 with:
62 # The nixpkgs-ci cache should not be trusted or used outside of Nixpkgs and its forks' CI.
63 name: ${{ vars.CACHIX_NAME || 'nixpkgs-ci' }}
64 extraPullNames: nixpkgs-ci
65 authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
66 pushFilter: '(-source$|-nixpkgs-tarball-)'
67
68 - run: nix-env --install -f nixpkgs/untrusted-pinned -A nix-build-uncached
69
70 - name: Build shell
71 if: contains(matrix.builds, 'shell')
72 run: echo "${{ matrix.systems }}" | xargs -n1 nix-build-uncached nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A shell --argstr system
73
74 - name: Build NixOS manual
75 if: |
76 contains(matrix.builds, 'manual-nixos') && !cancelled() &&
77 contains(fromJSON(inputs.baseBranch).type, 'primary')
78 run: nix-build-uncached nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A manual-nixos --out-link nixos-manual
79
80 - name: Build Nixpkgs manual
81 if: contains(matrix.builds, 'manual-nixpkgs') && !cancelled()
82 run: nix-build-uncached nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A manual-nixpkgs -A manual-nixpkgs-tests
83
84 - name: Build Nixpkgs manual tests
85 if: contains(matrix.builds, 'manual-nixpkgs-tests') && !cancelled()
86 run: nix-build-uncached nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A manual-nixpkgs-tests
87
88 - name: Build lib tests
89 if: contains(matrix.builds, 'lib-tests') && !cancelled()
90 run: nix-build-uncached nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A lib-tests
91
92 - name: Build tarball
93 if: contains(matrix.builds, 'tarball') && !cancelled()
94 run: nix-build-uncached nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A tarball
95
96 - name: Upload NixOS manual
97 if: |
98 contains(matrix.builds, 'manual-nixos') && !cancelled() &&
99 contains(fromJSON(inputs.baseBranch).type, 'primary')
100 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
101 with:
102 name: nixos-manual-${{ matrix.name }}
103 path: nixos-manual