Skip to content

clang-tools: move into llvmPackages#191698

Merged
JohnRTitor merged 4 commits intoNixOS:masterfrom
ShamrockLee:clang-tools-python
Jun 22, 2024
Merged

clang-tools: move into llvmPackages#191698
JohnRTitor merged 4 commits intoNixOS:masterfrom
ShamrockLee:clang-tools-python

Conversation

@ShamrockLee
Copy link
Copy Markdown
Contributor

@ShamrockLee ShamrockLee commented Sep 17, 2022

Description of changes

Format the Nix expression of clang-tools using nixfmt, in accordance with NixOS/rfcs#166.

Move the The clang-tools expression folder under llvm/common and clang-tools package under llvmPackages.

Move clang-tools_<version> into aliases.nix, specifying as llvmPackages_<version>.clang-tools.

Provide clang-tools-python that links and wraps executables from clang-unwrapped.python output. If applied, users will be able to enjoy git clang-format with clang-tools-python installed (or introduced inside Nix shell).

As for "${clang-unwrapped.python}/bin/scan-view", it depends on the relative module inside "../share". The dependent module of scan-view, ScanView.py, is currently not moved into clang-unwrapped.python, which will be fixed by the staging PR #191801.

Cc:
@Patryk27 clang-tools maintainer

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage (The 24 updated packages will take some time to build.)
  • Tested basic functionality of all binary files (usually in ./result/bin/) (Tested git-clang-format, but not scan-view)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@ShamrockLee
Copy link
Copy Markdown
Contributor Author

@ofborg build bat-extras.prettybat cloudcompare entwine grass libpulsar nominatim pdal python310Packages.tiledb python39Packages.tiledb qgis qgis-ltr tiledb vscode-extensions.ms-vscode-cpptools

@ofborg ofborg bot requested a review from Patryk27 September 17, 2022 19:13
@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Sep 17, 2022
@ShamrockLee ShamrockLee marked this pull request as ready for review September 17, 2022 19:39
@ShamrockLee
Copy link
Copy Markdown
Contributor Author

ShamrockLee commented Sep 18, 2022

Just seperate those Python scripts to a new output python, so that packages depending on clang-tools won't be forced to have Python in their closures.

It will still be installed as meta.outputsToInstall are set to include "python".

Thank you for your time and patience.

@ofborg ofborg bot requested a review from Patryk27 September 18, 2022 13:40
Copy link
Copy Markdown
Member

@Patryk27 Patryk27 left a comment

Choose a reason for hiding this comment

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

Looks pretty neat 🙂

@bobby285271 bobby285271 added the 12.approvals: 1 This PR was reviewed and approved by one person. label Sep 18, 2022
@ofborg ofborg bot requested a review from Patryk27 September 22, 2022 18:50
@ofborg ofborg bot added the 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. label Sep 22, 2022
@ShamrockLee
Copy link
Copy Markdown
Contributor Author

Could it be merged now?

Or should I split the wrapped python script into a new derivation clang-tools-python to reduce the number of rebuild?

@Patryk27
Copy link
Copy Markdown
Member

The changes look fine to me -- I don't personally have merging rights, though 👀

@ShamrockLee
Copy link
Copy Markdown
Contributor Author

No wonder. I had thought that all the members have the merging right.

@ShamrockLee ShamrockLee changed the title clang-tools: provide "${clang-unwrapped.python}/bin/*" executables clang-tools-python: init Dec 2, 2022
@ofborg ofborg bot added the 8.has: package (new) This PR adds a new package label Dec 2, 2022
@ShamrockLee ShamrockLee requested a review from Patryk27 December 3, 2022 01:07
@ShamrockLee
Copy link
Copy Markdown
Contributor Author

Just make a new derivation clang-tools-python instead. This way, packages depending on clang-tools won't have to rebuild whenever python gets rebuild.

Wrapping the Python scripts into a new package also guarantees zero rebuild of the current packages, and is thus easier to backport.

Copy link
Copy Markdown
Member

@Patryk27 Patryk27 left a comment

Choose a reason for hiding this comment

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

🚀

@nixos-discourse
Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/1507

@ShamrockLee ShamrockLee force-pushed the clang-tools-python branch 2 times, most recently from 6f5a41c to 95e28fa Compare December 9, 2022 20:50
@ShamrockLee ShamrockLee requested review from SuperSandro2000 and removed request for matthewbauer December 9, 2022 20:57
@nixos-discourse
Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/1638

@ShamrockLee ShamrockLee force-pushed the clang-tools-python branch from 45cab1a to 637c2de Compare May 15, 2024 22:26
@ShamrockLee
Copy link
Copy Markdown
Contributor Author

ShamrockLee commented May 15, 2024

I bumped it onto the master branch, resolved merge conflicts, and revised the release note to use the imperative mood.

@ofborg ofborg bot requested a review from Patryk27 May 15, 2024 22:58
@wegank wegank added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels May 22, 2024
Copy link
Copy Markdown
Member

@RossComputerGuy RossComputerGuy left a comment

Choose a reason for hiding this comment

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

Just resolve the conflicts and this should be good to go.

@ShamrockLee
Copy link
Copy Markdown
Contributor Author

@RossComputerGuy The release note entry is inside rl-2405.section.md. Is it okay to backport this PR, or how should I handle the release note entry?

@RossComputerGuy
Copy link
Copy Markdown
Member

RossComputerGuy commented May 28, 2024

@ShamrockLee I don't think it's too late to backport. Imo, release note entries are not that important for something like this.

@rrbutani
Copy link
Copy Markdown
Contributor

rrbutani commented May 28, 2024

Is it okay to backport this PR

I don't think it's too late to backport

I think we should maybe get a second opinion on this; breaking changes are restricted <4 weeks before 24.05's release and changing the clang-tools_* attributes to aliases could be construed as breaking.

Imo, release note entries are not that important for something like this.

I think it's worth having, especially since the intent (as per the OP) is to phase out the aliases that were added.

@ShamrockLee
Copy link
Copy Markdown
Contributor Author

@rrbutani Not sure if the change of <pkg>.override interfaces caused by moving clang-tools into llvmPakcages would also be considered backward-incompatible.

Copy link
Copy Markdown
Contributor

@rrbutani rrbutani left a comment

Choose a reason for hiding this comment

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

Looks good, couple of nits about the release note entry:

Copy link
Copy Markdown
Contributor

@rrbutani rrbutani May 28, 2024

Choose a reason for hiding this comment

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

nit: the scope that's used in llvmPackages already has version:

https://github.com/NixOS/nixpkgs/blob/0179f8c547879eb26016fb1dcda2904001487a3d/pkgs/development/compilers/llvm/18/default.nix#L61

You should be able to drop clang-unwrapped from this package's attrs (and all of the llvmPackages_* set's callPackages for clang-tools) and just ask for version in this package's attrs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since clang-tools is a wrapper of (a part of) clang-unwrapped, the build process would be more straightforward to pass clang-unwrapped as a shell variable. It's also okay to string-interpolate it directly.

As for the version, it makes sense to pass it from the llvmPackage an <pkg>.override argument.

You should be able to drop clang-unwrapped from this package's attrs

Are we removing the attribute to prevent people from accessing the clang-unwrapped package used via the attribute (or even try to override it via <pkg>.overrideAttrs) but encourage accessing/overriding via llvmPackages instead?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My apologies, I missed that the $out/bin symlinks are produced from clang-unwrapped and not clang/libcxxClang.

Please disregard the above; getting version from clang-unwrapped seems like the sensible thing to do.

@rrbutani
Copy link
Copy Markdown
Contributor

Not sure if the change of <pkg>.override interfaces caused by moving clang-tools into llvmPakcages would also be considered backward-incompatible.

oh, good point! here, let's ask:


@wegank This PR changes some top-level attrs to be aliases and changes some package attributes such that existing clang-tools_<ver>.override { ... } invocations may break (now takes clang, libcxxClang instead of llvmPackages). We're wondering if this is okay to backport to 24.05 or if this is considered a breaking change.

@wegank
Copy link
Copy Markdown
Member

wegank commented May 28, 2024

I'd consider the change of argument for clang-tools to be breaking. There's also the move to aliases for clang-tools_1{2-8}, which sounds breaking too.

Copy link
Copy Markdown
Contributor

@rrbutani rrbutani left a comment

Choose a reason for hiding this comment

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

@ShamrockLee thanks for working on this; one last minor change and this will be good to merge:

@ShamrockLee
Copy link
Copy Markdown
Contributor Author

I just rebased the feature branch on top of the master branch and resolved the merge conflict of the release note entries.

Is there anything I could help to push it forward?

@ShamrockLee
Copy link
Copy Markdown
Contributor Author

I simplified the package calling of clang-tools in each llvmPackages and fixed the evaluation, i.e.

     # Wrapper for standalone command line utilities
-    clang-tools = callPackage ../common/clang-tools {
-      inherit (tools) clang-unwrapped clang libcxxClang;
-      inherit llvm_meta;
-    };
+    clang-tools = callPackage ../common/clang-tools { };

Format default.nix with nixfmt in accordance with Nix RFC 166.

Manually Place the comments above the corresponding argument.
Add 24.11 release note entry about moving clang-tools into llvmPackages
and making clang-tools_<version> aliases.
@JohnRTitor
Copy link
Copy Markdown
Member

JohnRTitor commented Jun 22, 2024

Ok, I rebased it, lets merge this one after CI passes. It's been long due already.

@JohnRTitor
Copy link
Copy Markdown
Member

Result of nixpkgs-review pr 191698 run on x86_64-linux 1

1 package blacklisted:
  • nixos-install-tools
6 packages built:
  • llvmPackages_12.clang-tools
  • llvmPackages_13.clang-tools
  • llvmPackages_14.clang-tools
  • llvmPackages_15.clang-tools
  • llvmPackages_16.clang-tools
  • llvmPackages_18.clang-tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: clean-up This PR removes packages or removes other cruft 8.has: documentation This PR adds or changes documentation 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 12.approvals: 3+ This PR was reviewed and approved by three or more persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants