Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tools: move into llvmPackages #191698

Merged
merged 4 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
Also be aware that if you have set additional options in `services.wstunnel.{clients,servers}.<name>.extraArgs`,
that those might have been removed or modified upstream.

- `clang-tools_<version>` packages have been moved into `llvmPackages_<version>` (i.e. `clang-tools_18` is now `llvmPackages_18.clang-tools`).
- For convenience, the top-level `clang-tools` attribute remains and is now bound to `llvmPackages.clang-tools`.
- Top-level `clang_tools_<version>` attributes are now aliases; these will be removed in a future release.

- `nginx` package no longer includes `gd` and `geoip` dependencies. For enabling it, override `nginx` package with the optionals `withImageFilter` and `withGeoIP`.

- `openssh` and `openssh_hpn` are now compiled without Kerberos 5 / GSSAPI support in an effort to reduce the attack surface of the components for the majority of users. Users needing this support can
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/12/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ let
# python3 = pkgs.python3; # don't use python-boot
# });

# Wrapper for standalone command line utilities
clang-tools = callPackage ../common/clang-tools { };

# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/13/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ in let
# python3 = pkgs.python3; # don't use python-boot
# });

# Wrapper for standalone command line utilities
clang-tools = callPackage ../common/clang-tools { };

# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/14/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ in let
# python3 = pkgs.python3; # don't use python-boot
# });

# Wrapper for standalone command line utilities
clang-tools = callPackage ../common/clang-tools { };

# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/15/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ in let
python3 = pkgs.python3; # don't use python-boot
});

# Wrapper for standalone command line utilities
clang-tools = callPackage ../common/clang-tools { };

# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/16/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ in let
python3 = pkgs.python3; # don't use python-boot
});

# Wrapper for standalone command line utilities
clang-tools = callPackage ../common/clang-tools { };

# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/17/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ in let
python3 = pkgs.python3; # don't use python-boot
});

# Wrapper for standalone command line utilities
clang-tools = callPackage ../common/clang-tools { };

# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/18/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ in let
python3 = pkgs.python3; # don't use python-boot
});

# Wrapper for standalone command line utilities
clang-tools = callPackage ../common/clang-tools { };

# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
{ lib, stdenv, llvmPackages, enableLibcxx ? false }:
# enableLibcxx will use the c++ headers from clang instead of gcc.
# This shouldn't have any effect on platforms that use clang as the default compiler already.

let
unwrapped = llvmPackages.clang-unwrapped;

in stdenv.mkDerivation {
inherit unwrapped;
{
lib,
stdenv,
clang-unwrapped,
clang,
libcxxClang,
llvm_meta,
# enableLibcxx will use the c++ headers from clang instead of gcc.
# This shouldn't have any effect on platforms that use clang as the default compiler already.
enableLibcxx ? false,
}:

stdenv.mkDerivation {
unwrapped = clang-unwrapped;

pname = "clang-tools";
version = lib.getVersion unwrapped;
version = lib.getVersion clang-unwrapped;
Copy link
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
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
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.

dontUnpack = true;
clang = if enableLibcxx then llvmPackages.libcxxClang else llvmPackages.clang;
clang = if enableLibcxx then libcxxClang else clang;

installPhase = ''
runHook preInstall
Expand Down Expand Up @@ -47,7 +52,7 @@ in stdenv.mkDerivation {
runHook postInstall
'';

meta = unwrapped.meta // {
meta = llvm_meta // {
description = "Standalone command line tools for C++ development";
maintainers = with lib.maintainers; [ patryk27 ];
};
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/git/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ in let
python3 = pkgs.python3; # don't use python-boot
});

# Wrapper for standalone command line utilities
clang-tools = callPackage ../common/clang-tools { };

# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
Expand Down
9 changes: 9 additions & 0 deletions pkgs/top-level/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,16 @@ mapAliases ({
clang_10 = throw "clang_10 has been removed from nixpkgs"; # Added 2024-01-26
clang_11 = throw "clang_11 has been removed from nixpkgs"; # Added 2023-01-24

clang-tools_12 = llvmPackages_12.clang-tools; # Added 2024-04-22
clang-tools_13 = llvmPackages_13.clang-tools; # Added 2024-04-22
clang-tools_14 = llvmPackages_14.clang-tools; # Added 2024-04-22
clang-tools_15 = llvmPackages_15.clang-tools; # Added 2024-04-22
clang-tools_16 = llvmPackages_16.clang-tools; # Added 2024-04-22
clang-tools_17 = llvmPackages_17.clang-tools; # Added 2024-04-22
clang-tools_18 = llvmPackages_18.clang-tools; # Added 2024-04-22

cq-editor = throw "cq-editor has been removed, as it use a dependency that was disabled since python 3.8 and was last updated in 2021"; # Added 2024-05-13

### D ###

dagger = throw "'dagger' has been removed from nixpkgs, as the trademark policy of the upstream project is incompatible"; # Added 2023-10-16
Expand Down
33 changes: 2 additions & 31 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15177,31 +15177,7 @@ with pkgs;
clang_16 = llvmPackages_16.clang;
clang_17 = llvmPackages_17.clang;

clang-tools = callPackage ../development/tools/clang-tools { };

clang-tools_12 = callPackage ../development/tools/clang-tools {
llvmPackages = llvmPackages_12;
};

clang-tools_13 = callPackage ../development/tools/clang-tools {
llvmPackages = llvmPackages_13;
};

clang-tools_14 = callPackage ../development/tools/clang-tools {
llvmPackages = llvmPackages_14;
};

clang-tools_15 = callPackage ../development/tools/clang-tools {
llvmPackages = llvmPackages_15;
};

clang-tools_16 = callPackage ../development/tools/clang-tools {
llvmPackages = llvmPackages_16;
};

clang-tools_17 = callPackage ../development/tools/clang-tools {
llvmPackages = llvmPackages_17;
};
clang-tools = llvmPackages.clang-tools;

clang-analyzer = callPackage ../development/tools/analysis/clang-analyzer {
llvmPackages = llvmPackages_14;
Expand Down Expand Up @@ -16276,17 +16252,12 @@ with pkgs;
lld_18 = llvmPackages_18.lld;
lldb_18 = llvmPackages_18.lldb;
llvm_18 = llvmPackages_18.llvm;

clang-tools_18 = callPackage ../development/tools/clang-tools {
llvmPackages = llvmPackages_18;
};
})
llvmPackages_18
clang_18
lld_18
lldb_18
llvm_18
clang-tools_18;
llvm_18;

lorri = callPackage ../tools/misc/lorri {
inherit (darwin.apple_sdk.frameworks) CoreServices Security;
Expand Down