Skip to content

cmake: the setup hook breaks with __structuredAttrs = true #289037

@fgaz

Description

@fgaz

Describe the bug

The cmake setup hook breaks with __structuredAttrs = true.

Steps To Reproduce

Write a derivation that uses cmake with __structuredAttrs = true and set cmakeFlags to a list with >1 element.
The build hook always treats $cmakeFlags as a normal variable, so it uses only the first array element.

Expected behavior

The flags get passed to cmake

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Solution used in the npm hook:

# Based on code from Python's buildPythonPackage wrap.sh script, for
# supporting both the case when makeWrapperArgs is an array and a
# IFS-separated string.
#
# TODO: remove the string branch when __structuredAttrs are used.
if [[ "${makeWrapperArgs+defined}" == "defined" && "$(declare -p makeWrapperArgs)" =~ ^'declare -a makeWrapperArgs=' ]]; then
local -a user_args=("${makeWrapperArgs[@]}")
else
local -a user_args="(${makeWrapperArgs:-})"
fi

Workaround: use cmakeFlagsArray instead.

Notify maintainers

@teto @ttuegel @LnL7 @AndersonTorres

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

Labels

0.kind: bugSomething is broken1.severity: significantNovel ideas, large API changes, notable refactorings, issues with RFC potential, etc.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions