From 40cf55bfff73c9f148bd554b7c907bd966c3d9c6 Mon Sep 17 00:00:00 2001 From: cadkin Date: Sun, 30 Apr 2023 14:02:39 -0400 Subject: [PATCH] clazy: init at 1.11 --- .../tools/analysis/clazy/default.nix | 56 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 5 ++ 2 files changed, 61 insertions(+) create mode 100644 pkgs/development/tools/analysis/clazy/default.nix diff --git a/pkgs/development/tools/analysis/clazy/default.nix b/pkgs/development/tools/analysis/clazy/default.nix new file mode 100644 index 000000000000..10c61bf88881 --- /dev/null +++ b/pkgs/development/tools/analysis/clazy/default.nix @@ -0,0 +1,56 @@ +{ + lib + , stdenv + , fetchFromGitHub + , llvmPackages + , cmake + , makeWrapper +}: + +stdenv.mkDerivation rec { + pname = "clazy"; + version = "1.11"; + + src = fetchFromGitHub { + owner = "KDE"; + repo = "clazy"; + rev = "v${version}"; + sha256 = "sha256-kcl4dUg84fNdizKUS4kpvIKFfajtTRdz+MYUbKcMFvg="; + }; + + buildInputs = [ + llvmPackages.llvm + llvmPackages.libclang + ]; + + nativeBuildInputs = [ + cmake + makeWrapper + ]; + + postInstall = '' + wrapProgram $out/bin/clazy \ + --suffix PATH : "${llvmPackages.clang}/bin/" \ + --suffix CPATH : "$(<${llvmPackages.clang}/nix-support/libc-cflags)" \ + --suffix CPATH : "${llvmPackages.clang}/resource-root/include" \ + --suffix CPLUS_INCLUDE_PATH : "$(<${llvmPackages.clang}/nix-support/libcxx-cxxflags)" \ + --suffix CPLUS_INCLUDE_PATH : "$(<${llvmPackages.clang}/nix-support/libc-cflags)" \ + --suffix CPLUS_INCLUDE_PATH : "${llvmPackages.clang}/resource-root/include" + + wrapProgram $out/bin/clazy-standalone \ + --suffix CPATH : "$(<${llvmPackages.clang}/nix-support/libc-cflags)" \ + --suffix CPATH : "${llvmPackages.clang}/resource-root/include" \ + --suffix CPLUS_INCLUDE_PATH : "$(<${llvmPackages.clang}/nix-support/libcxx-cxxflags)" \ + --suffix CPLUS_INCLUDE_PATH : "$(<${llvmPackages.clang}/nix-support/libc-cflags)" \ + --suffix CPLUS_INCLUDE_PATH : "${llvmPackages.clang}/resource-root/include" + ''; + + meta = { + description = "Qt-oriented static code analyzer based on the Clang framework"; + homepage = "https://github.com/KDE/clazy"; + license = lib.licenses.lgpl2Plus; + maintainers = [ lib.maintainers.cadkin ]; + platforms = lib.platforms.linux; + }; + +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f4829aa9227a..7b8bb0b825ef 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14419,6 +14419,11 @@ with pkgs; inherit (llvmPackages_latest) clang; }; + clazy = callPackage ../development/tools/analysis/clazy { + llvmPackages = llvmPackages_latest; + stdenv = llvmPackages_latest.stdenv; + }; + #Use this instead of stdenv to build with clang clangStdenv = if stdenv.cc.isClang then stdenv else lowPrio llvmPackages.stdenv; clang-sierraHack-stdenv = overrideCC stdenv buildPackages.clang-sierraHack;