3
0
Fork 0
forked from mirrors/nixpkgs

php.buildEnv: Automatically include extension dependencies

Some extensions depend on other extensions. Previously, these had to
be added manually to the list of included extensions, or we got a
cryptic error message pointing to strings-with-deps.nix, which wasn't
very helpful. This makes sure all required extensions are included in
the set from which textClosureList chooses its snippets.
This commit is contained in:
talyz 2020-04-24 18:11:40 +02:00
parent 72636bc2f6
commit d61040716e
No known key found for this signature in database
GPG key ID: 2DED2151F4671A2B

View file

@ -71,6 +71,19 @@ let
getExtName = ext: lib.removePrefix "php-" (builtins.parseDrvName ext.name).name;
# Recursively get a list of all internal dependencies
# for a list of extensions.
getDepsRecursively = extensions:
let
deps = lib.concatMap
(ext: ext.internalDeps or [])
extensions;
in
if ! (deps == []) then
deps ++ (getDepsRecursively deps)
else
deps;
# Generate extension load configuration snippets from the
# extension parameter. This is an attrset suitable for use
# with textClosureList, which is used to put the strings in
@ -89,7 +102,7 @@ let
deps = lib.optionals (ext ? internalDeps)
(map getExtName ext.internalDeps);
})
enabledExtensions);
(enabledExtensions ++ (getDepsRecursively enabledExtensions)));
extNames = map getExtName enabledExtensions;
extraInit = writeText "custom-php.ini" ''