|
93 | 93 | # Convert sets into lists
|
94 | 94 | composerRequiresMap = map (package: (map (key: builtins.getAttr key package) (builtins.attrNames package))) composerRequiresKeys;
|
95 | 95 | in
|
96 |
| - # Convert the set into a list, filter out values not starting with "ext-", get rid of the first 4 characters from the name |
97 |
| - map (x: builtins.substring 4 (builtins.stringLength x) x) (builtins.filter (x: (builtins.substring 0 4 x) == "ext-") (lib.flatten composerRequiresMap)); |
| 96 | + # Convert the set into a list, filter out values not starting with "ext-", get rid of the first 4 characters from the name |
| 97 | + map (x: builtins.substring 4 (builtins.stringLength x) x) (builtins.filter (x: (builtins.substring 0 4 x) == "ext-") (lib.flatten composerRequiresMap)); |
98 | 98 |
|
99 | 99 | requiredExts = getExtensionFromComposerSection "require";
|
100 | 100 | requiredDevExts = getExtensionFromComposerSection "require-dev";
|
|
115 | 115 | extensions = { all, ... }: (map (ext: all."${ext}") (builtins.filter (ext: all ? "${ext}") extensions));
|
116 | 116 | });
|
117 | 117 |
|
118 |
| - phpDerivations = rec |
| 118 | + phpConfigs = rec |
119 | 119 | {
|
120 |
| - default = phpDerivations.php81; |
| 120 | + default = phpConfigs.php81; |
121 | 121 |
|
122 | 122 | php56 = {
|
123 | 123 | php = phps.php56;
|
|
163 | 163 | };
|
164 | 164 | };
|
165 | 165 |
|
166 |
| - # Build PHP NTS. |
167 |
| - phpDerivationsWithNts = phpDerivations // lib.mapAttrs' (name: php: |
168 |
| - lib.nameValuePair |
169 |
| - (name + "-nts") |
170 |
| - ( |
171 |
| - php // { |
172 |
| - flags = { |
173 |
| - apxs2Support = false; |
174 |
| - ztsSupport = false; |
175 |
| - }; |
176 |
| - } |
177 |
| - ) |
178 |
| - ) phpDerivations; |
179 |
| - in |
180 |
| - { |
181 |
| - # In use for "nix shell" |
182 |
| - packages = builtins.mapAttrs |
| 166 | + # Build PHP NTS configurations. |
| 167 | + phpConfigsWithNts = phpConfigs // lib.mapAttrs' |
| 168 | + (name: php: |
| 169 | + lib.nameValuePair |
| 170 | + (name + "-nts") |
| 171 | + ( |
| 172 | + php // { |
| 173 | + flags = { |
| 174 | + apxs2Support = false; |
| 175 | + ztsSupport = false; |
| 176 | + }; |
| 177 | + } |
| 178 | + ) |
| 179 | + ) |
| 180 | + phpConfigs; |
| 181 | + |
| 182 | + # Build PHP environments (simple + extended) |
| 183 | + phpEnvs = builtins.mapAttrs |
183 | 184 | (name: phpConfig: pkgs.buildEnv {
|
184 | 185 | inherit name;
|
185 | 186 | paths = [
|
186 | 187 | (makePhp {
|
187 | 188 | php = phpConfig.php;
|
188 |
| - flags = phpConfig.flags or {}; |
| 189 | + flags = phpConfig.flags or { }; |
189 | 190 | withExtensions = phpConfig.withExtensions;
|
190 |
| - withoutExtensions = phpConfig.withoutExtensions or []; |
| 191 | + withoutExtensions = phpConfig.withoutExtensions or [ ]; |
191 | 192 | })
|
192 | 193 | ];
|
193 | 194 | })
|
194 |
| - phpDerivationsWithNts // |
195 |
| - lib.mapAttrs' (name: phpConfig: |
| 195 | + phpConfigsWithNts // |
| 196 | + lib.mapAttrs' |
| 197 | + (name: phpConfig: |
196 | 198 | let
|
197 | 199 | pname = "env-" + name;
|
198 | 200 | in
|
|
201 | 203 | (
|
202 | 204 | makePhpEnv pname (makePhp {
|
203 | 205 | php = phpConfig.php;
|
204 |
| - flags = phpConfig.flags or {}; |
| 206 | + flags = phpConfig.flags or { }; |
205 | 207 | withExtensions = phpConfig.withExtensions;
|
206 |
| - withoutExtensions = phpConfig.withoutExtensions or []; |
| 208 | + withoutExtensions = phpConfig.withoutExtensions or [ ]; |
207 | 209 | })
|
208 | 210 | )
|
209 |
| - ) phpDerivationsWithNts; |
| 211 | + ) |
| 212 | + phpConfigsWithNts; |
| 213 | + in |
| 214 | + { |
| 215 | + # In use for "nix shell" |
| 216 | + packages = phpEnvs; |
210 | 217 |
|
211 | 218 | # In use for "nix develop"
|
212 | 219 | devShells = builtins.mapAttrs
|
213 |
| - (name: phpConfig: pkgs.mkShellNoCC { |
| 220 | + (name: phpEnv: pkgs.mkShellNoCC { |
214 | 221 | inherit name;
|
215 | 222 | buildInputs = [
|
216 |
| - (makePhp { |
217 |
| - php = phpConfig.php; |
218 |
| - flags = phpConfig.flags or {}; |
219 |
| - withExtensions = phpConfig.withExtensions ++ requiredDevExts; |
220 |
| - withoutExtensions = phpConfig.withoutExtensions or []; |
221 |
| - }) |
| 223 | + phpEnv |
222 | 224 | ];
|
223 | 225 | })
|
224 |
| - phpDerivationsWithNts // |
225 |
| - lib.mapAttrs' (name: phpConfig: |
226 |
| - let |
227 |
| - phpEnv = makePhpEnv name (makePhp { |
228 |
| - php = phpConfig.php; |
229 |
| - flags = phpConfig.flags or {}; |
230 |
| - withExtensions = phpConfig.withExtensions ++ requiredDevExts; |
231 |
| - withoutExtensions = phpConfig.withoutExtensions or []; |
232 |
| - }); |
233 |
| - in |
234 |
| - let |
235 |
| - pname = "env-" + name; |
236 |
| - in |
237 |
| - lib.nameValuePair |
238 |
| - (pname) |
239 |
| - ( |
240 |
| - pkgs.mkShellNoCC { |
241 |
| - name = pname; |
242 |
| - buildInputs = [ phpEnv ]; |
243 |
| - } |
244 |
| - ) |
245 |
| - ) |
246 |
| - phpDerivationsWithNts; |
| 226 | + phpEnvs; |
247 | 227 | }
|
248 | 228 | );
|
249 | 229 | }
|
0 commit comments