|
144 | 144 | }) buildSets |
145 | 145 | ); |
146 | 146 |
|
147 | | - # Dependencies that should be cached. |
| 147 | + # Dependencies that should be cached, the structure of the output |
| 148 | + # path is: <build variant>/<dependency>-<output> |
148 | 149 | forCache = |
149 | 150 | let |
150 | 151 | filterDist = lib.filter (output: output != "dist"); |
151 | | - # Get all `torch` outputs except for `dist`. Not all outputs |
152 | | - # are dependencies of `out`, but we'll need the `cxxdev` and |
153 | | - # `dev` outputs for kernel builds. |
154 | | - torchOutputs = builtins.listToAttrs ( |
155 | | - lib.flatten ( |
156 | | - # Map over build sets. |
157 | | - map ( |
158 | | - buildSet: |
159 | | - # Map over all outputs of `torch` in a buildset. |
160 | | - map (output: { |
161 | | - name = "${buildVersion buildSet}-${output}"; |
162 | | - value = buildSet.torch.${output}; |
163 | | - }) (filterDist buildSet.torch.outputs) |
164 | | - ) buildSets |
165 | | - ) |
166 | | - ); |
167 | | - oldLinuxStdenvs = builtins.listToAttrs ( |
168 | | - map (buildSet: { |
169 | | - name = "stdenv-${buildVersion buildSet}"; |
170 | | - value = buildSet.pkgs.stdenvGlibc_2_27; |
171 | | - }) buildSets |
172 | | - ); |
| 152 | + # Get all outputs except for `dist` (which is the built wheel for Torch). |
| 153 | + allOutputs = |
| 154 | + drv: |
| 155 | + map (output: { |
| 156 | + name = "${drv.pname or drv.name}-${output}"; |
| 157 | + path = drv.${output}; |
| 158 | + }) (filterDist drv.outputs or [ "out" ]); |
| 159 | + buildSetOutputs = |
| 160 | + buildSet: |
| 161 | + with buildSet.pkgs; |
| 162 | + ( |
| 163 | + allOutputs buildSet.torch |
| 164 | + ++ allOutputs build2cmake |
| 165 | + ++ allOutputs kernel-abi-check |
| 166 | + ++ allOutputs python3Packages.kernels |
| 167 | + ++ allOutputs stdenvGlibc_2_27 |
| 168 | + ); |
| 169 | + buildSetLinkFarm = buildSet: pkgs.linkFarm (buildVersion buildSet) (buildSetOutputs buildSet); |
173 | 170 | in |
174 | 171 | pkgs.linkFarm "packages-for-cache" ( |
175 | | - { |
176 | | - inherit build2cmake kernel-abi-check; |
177 | | - } |
178 | | - // torchOutputs |
179 | | - // lib.optionalAttrs nixpkgs.legacyPackages.${system}.stdenv.isLinux oldLinuxStdenvs |
| 172 | + map (buildSet: { |
| 173 | + name = buildVersion buildSet; |
| 174 | + path = buildSetLinkFarm buildSet; |
| 175 | + }) buildSets |
180 | 176 | ); |
181 | 177 | }; |
182 | 178 | } |
|
0 commit comments