Skip to content

buildDubPackage: fix flag arrays not being expanded correctly#486535

Merged
TomaSajt merged 1 commit intoNixOS:masterfrom
CyberShadow:dub-flags-array
Feb 4, 2026
Merged

buildDubPackage: fix flag arrays not being expanded correctly#486535
TomaSajt merged 1 commit intoNixOS:masterfrom
CyberShadow:dub-flags-array

Conversation

@CyberShadow
Copy link
Member

@CyberShadow CyberShadow commented Feb 3, 2026

Use concatTo to properly handle dubBuildFlags, dubTestFlags, and dubFlags. Previously these were used as "${var[@]}" but Nix lists become space-separated strings, not bash arrays, causing all flags to be concatenated into a single argument.

Motivating example:

          dubBuildFlags = [ "--config=mysql-integration" "-d=ASOCKETS_DEBUG_IDLE" ];

became:

            > Error Unknown build configuration: mysql-integration -d=ASOCKETS_DEBUG_IDLE                                                                                          

CC @TomaSajt

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Use concatTo to properly handle dubBuildFlags, dubTestFlags, and
dubFlags. Previously these were used as "${var[@]}" but Nix lists
become space-separated strings, not bash arrays, causing all flags
to be concatenated into a single argument.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nixpkgs-ci nixpkgs-ci bot requested review from TomaSajt and jtbx February 3, 2026 11:30
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Feb 3, 2026
@SFrijters
Copy link
Member

Somewhat related to #205690 - perhaps you could migrate the dub infrastructure to __structuredAttrs = true; instead, in which case the flags are actual arrays.

@CyberShadow
Copy link
Member Author

That would be nice. @TomaSajt What do you think?

@TomaSajt
Copy link
Contributor

TomaSajt commented Feb 3, 2026

I am not very experienced in bash array stuff.
As you noticed, I failed to properly migrate from nix to bash in #344744

I don't know how to use __structuredAttrs so I can't really so anything about whether it's better or not.

Does the current solution work with and without __structuredAttrs?
If yes, that's the ideal solution IMO, because the dub hooks are allowed to be used separately, without using buildDubPackage directly, and in those situations it's not guaranteed that __structuredAttrs is on.

@CyberShadow
Copy link
Member Author

Does the current solution work with and without __structuredAttrs?

If you mean the solution in master right now, no; with this fix, it does seem to work with and without __structuredAttrs from looking at the code and a quick test. concatTo does the right thing in both situations.

Copy link
Contributor

@TomaSajt TomaSajt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's the case, then LGTM.

@TomaSajt TomaSajt added the backport release-25.11 Backport PR automatically label Feb 4, 2026
@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Feb 4, 2026
@TomaSajt TomaSajt added this pull request to the merge queue Feb 4, 2026
Merged via the queue into NixOS:master with commit 07e338b Feb 4, 2026
35 of 37 checks passed
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Feb 4, 2026

Successfully created backport PR for release-25.11:

@github-actions github-actions bot added the 8.has: port to stable This PR already has a backport to the stable release. label Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. backport release-25.11 Backport PR automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants