diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 5a97e648a7d7..286091ba75fc 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -14130,6 +14130,14 @@ name = "Kenichi Kamiya"; keys = [ { fingerprint = "9121 5D87 20CA B405 C63F 24D2 EF6E 574D 040A E2A5"; } ]; }; + kacper-uminski = { + name = "Kacper Uminski"; + email = "kacper+nixpkgs@lysator.liu.se"; + github = "kacper-uminski"; + githubId = 57466578; + matrix = "@kacper.uminski:matrix.org"; + keys = [ { fingerprint = "3DF9 3DEB CAA9 81FA B3E2 A7F0 87DA 201D E02F 14B1"; } ]; + }; kaction = { name = "Dmitry Bogatov"; email = "KAction@disroot.org"; diff --git a/pkgs/by-name/co/codechecker/package.nix b/pkgs/by-name/co/codechecker/package.nix index 305e2aa8b8e4..371c6b048095 100644 --- a/pkgs/by-name/co/codechecker/package.nix +++ b/pkgs/by-name/co/codechecker/package.nix @@ -1,65 +1,30 @@ { lib, - python3, fetchPypi, - fetchFromGitHub, - clang, + makeWrapper, + python3Packages, + libclang, clang-tools, cppcheck, gcc, - makeWrapper, + infer, withClang ? false, withClangTools ? false, withCppcheck ? false, withGcc ? false, + withInfer ? false, }: -let - python = python3.override { - packageOverrides = self: super: rec { - # codechecker is incompatible with SQLAlchemy greater than 1.3 - sqlalchemy = super.sqlalchemy_1_4.overridePythonAttrs (oldAttrs: rec { - version = "1.3.23"; - pname = oldAttrs.pname; - src = fetchFromGitHub { - owner = "sqlalchemy"; - repo = "sqlalchemy"; - rev = "rel_${lib.replaceStrings [ "." ] [ "_" ] version}"; - hash = "sha256-hWA0/f7rQpEfYTg10i0rBK3qeJbw3p6HW7S59rLnD0Q="; - }; - doCheck = false; - # That test does not exist in the 1.3 branch so we get an error for disabling it - disabledTestPaths = builtins.filter ( - testPath: testPath != "test/ext/mypy" - ) oldAttrs.disabledTestPaths; - }); - sqlalchemy_1_4 = sqlalchemy; - - # The current alembic version is not compatible with SQLAlchemy 1.3 so we need to downgrade it - alembic = super.alembic.overridePythonAttrs (oldAttrs: rec { - pname = "alembic"; - version = "1.5.5"; - src = fetchPypi { - inherit pname version; - hash = "sha256-3wAowZJ1os/xN+OWF6Oc3NvRFzczuHtr+iV7fAhgITs="; - }; - doCheck = false; - dependencies = oldAttrs.dependencies ++ [ - super.python-dateutil - super.python-editor - ]; - }); - }; - }; - python3Packages = python.pkgs; -in python3Packages.buildPythonApplication rec { pname = "codechecker"; - version = "6.24.0"; + version = "6.28.0"; pyproject = true; + strictDeps = true; + __structuredAttrs = true; + src = fetchPypi { inherit pname version; - hash = "sha256-ftZACUf2lAHokcUXj45LRA7/3goOcIy521cGl6qhR98="; + hash = "sha256-wxV+/hzsk7RrzWTXNz5HyweYdFFI1upNS508QRPCefo="; }; build-system = with python3Packages; [ @@ -67,40 +32,39 @@ python3Packages.buildPythonApplication rec { ]; dependencies = with python3Packages; [ + alembic + argcomplete + authlib distutils # required in python312 to call subcommands (see https://github.com/Ericsson/codechecker/issues/4350) lxml - sqlalchemy - alembic + multiprocess portalocker psutil - multiprocess + semver + sqlalchemy thrift gitpython pyyaml + requests types-pyyaml sarif-tools + types-psutil ]; - pythonRelaxDeps = [ - "thrift" - "portalocker" - "types-pyyaml" - "lxml" - "psutil" - "multiprocess" - "gitpython" - "sarif-tools" - "pyyaml" + pythonRelaxDeps = true; + nativeBuildInputs = with python3Packages; [ + makeWrapper + pythonRelaxDepsHook ]; postInstall = '' wrapProgram "$out/bin/CodeChecker" --prefix PATH : ${ lib.makeBinPath ( - [ ] - ++ lib.optional withClang clang + lib.optional withClang libclang ++ lib.optional withClangTools clang-tools ++ lib.optional withCppcheck cppcheck ++ lib.optional withGcc gcc + ++ lib.optional withInfer infer ) } ''; @@ -116,6 +80,7 @@ python3Packages.buildPythonApplication rec { maintainers = with lib.maintainers; [ zebreus felixsinger + kacper-uminski ]; mainProgram = "CodeChecker"; platforms = lib.platforms.darwin ++ lib.platforms.linux; diff --git a/pkgs/by-name/in/infer/package.nix b/pkgs/by-name/in/infer/package.nix new file mode 100644 index 000000000000..938573476336 --- /dev/null +++ b/pkgs/by-name/in/infer/package.nix @@ -0,0 +1,249 @@ +{ + fetchFromGitHub, + lib, + stdenv, + + # nativeBuildInputs + autoconf, + automake, + cmake, + dune_3, + git, + makeWrapper, + ninja, + opam, + pkg-config, + perl, + which, + + # buildInputs + gmp, + mpfr, + ocaml-ng, + sqlite, + zlib, + + # Erlang + beamPackages, + + # Java + jdk, + + # LLVM + python3, + + # Options + withErlang ? true, + withJava ? true, + withLLVM ? true, + withRust ? false, +}: +let + pname = "infer"; + version = "1.3.0"; + src = fetchFromGitHub { + owner = "facebook"; + repo = pname; + tag = "v${version}"; + hash = "sha256-Kq7sJVBqe4ei1HbZz8R+P4V6yxisxEmPVHjyVlpL1aw="; + }; + + # Pre-fetched LLVM source that facebook-clang-plugins would normally download + # They specify the version in `facebook-clang-plugins/clang/src/prepare_clang_src.sh` + # Please check that file and update the version as appropriate when updating + llvmSrc = fetchFromGitHub { + owner = "llvm"; + repo = "llvm-project"; + tag = "llvmorg-21.1.6"; + hash = "sha256-mqZLJYDEs6FXAjbSOruR2ATZZxemNMagNG9SMjSWBFE="; + }; + + # We need to use 5.3 because stdcompat (a transitive ocaml dependency) is + # broken on 5.4 + ocamlPackages = ocaml-ng.ocamlPackages_5_3.overrideScope ( + self: super: { + # Newer ppxlib removed a function needed by 0.36 + ppxlib = super.ppxlib.override { version = "0.34.0"; }; + # Infer bundles charon 0.1.177; nixpkgs unstable has a newer incompatible + # version + charon = super.buildDunePackage { + pname = "charon"; + version = "0.1"; + src = "${src}/dependencies/charon"; + propagatedBuildInputs = with self; [ + easy_logging + name_matcher_parser + ppx_deriving + unionFind + visitors + yojson + ]; + }; + } + ); + + erlangDeps = with beamPackages; [ + erlang + rebar3 + ]; + javaDeps = [ jdk ]; +in +stdenv.mkDerivation { + inherit pname src version; + + strictDeps = true; + __structuredAttrs = true; + + nativeBuildInputs = [ + autoconf + automake + cmake + dune_3 + git + makeWrapper + ninja + opam + pkg-config + perl + which + ] + ++ (with ocamlPackages; [ + atd + atdgen + ocaml + findlib + menhir + ocamlbuild + ]) + ++ lib.optionals withErlang erlangDeps + ++ lib.optionals withJava javaDeps + ++ lib.optional withLLVM python3; + + buildInputs = [ + gmp + mpfr + sqlite + zlib + ] + ++ (with ocamlPackages; [ + ansiterminal + atd + atdgen + base64 + bheap + charon + cmdliner + containers + containers-data + core + ctypes + fmt + fpath + iter + javalib + memtrace + menhirLib + mtime + ocamlgraph + ounit + ounit2 + parmap + ppx_blob + ppx_compare + ppx_enumerate + ppx_expect + ppx_fields_conv + ppx_show + ppx_yojson_conv + ppxlib + pyml + sawja + saturn + sedlex + spawn + ocaml_sqlite3 + tdigest + xmlm + zarith + ]) + ++ lib.optionals withErlang erlangDeps + ++ lib.optionals withJava javaDeps; + + preConfigure = '' + patchShebangs . + + ${lib.optionalString withLLVM + # sh + '' + # Link in the prefetched llvm source + mkdir -p facebook-clang-plugins/clang/src/download + ln -s ${llvmSrc} facebook-clang-plugins/clang/src/download/llvm-project + # Skip the download step in prepare_clang_src.sh + substituteInPlace facebook-clang-plugins/clang/src/prepare_clang_src.sh \ + --replace-fail 'curl -L' 'echo "SKIPPED: curl" #' \ + --replace-fail 'tar xf' 'echo "SKIPPED: tar" #' + + # Runtimes and bindings fail to build, as it tries to build them using its + # newly built clang, but infer seems to work with them disabled. + # Tools are needed because the build requires llvm-config. + substituteInPlace facebook-clang-plugins/clang/setup.sh \ + --replace-fail '-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind"' '-DLLVM_ENABLE_RUNTIMES=""'\ + --replace-fail '-DLLVM_BUILD_DOCS=Off' '-DLLVM_BUILD_DOCS=Off -DLLVM_ENABLE_BINDINGS=Off' \ + --replace-fail '-DLLVM_BUILD_TOOLS=Off' '-DLLVM_BUILD_TOOLS=On' + '' + } + + # Remove deprecated -j-std atdgen flag, which is removed in current atdgen + find . -name "dune" -exec sed -i 's/-j-std//g' {} + 2>/dev/null || true + + # Use nix-provided context. + substituteInPlace infer/dune-workspace.in \ + --replace-fail '(context (opam (switch @OPAMSWITCH@) (name default) (merlin)))' '(context default)' + + ./autogen.sh + ''; + + dontUseCmakeConfigure = true; + + configureFlags = [ + "--prefix=${placeholder "out"}" + ] + ++ [ + "--disable-hack-analyzers" # No support on nixpkgs as of writing + "--disable-python-analyzers" # Needs python 3.10, which is not in nixpkgs + "--disable-swift-analyzers" # Does not want to build with the current package + ] + ++ lib.optional (!withErlang) "--disable-erlang-analyzers" + ++ lib.optional (!withJava) "--disable-java-analyzers" + ++ lib.optional (!withLLVM) "--disable-c-analyzers" + ++ lib.optional withRust "--enable-rust-analyzers"; + + buildFlags = [ + # This cuts the build time in half + "CFLAGS=-O2" + "CXXFLAGS=-O2" + # Prevent ocaml warnings 11 and 55 from crashing the build + "OCAMLPARAM=_,w=-11-55" + ]; + + dontUseNinjaBuild = true; + dontUseNinjaInstall = true; + + postInstall = + let + runtimeDeps = lib.optionals withErlang erlangDeps ++ lib.optionals withJava javaDeps; + in + lib.optionalString (runtimeDeps != [ ]) '' + wrapProgram "$out/bin/infer" \ + --prefix PATH : "${lib.makeBinPath runtimeDeps}" + ''; + + meta = { + description = "Facebook's static analysis tool for Java, C++, Objective-C, and C."; + homepage = "https://fbinfer.com/"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.kacper-uminski ]; + platforms = lib.platforms.darwin ++ lib.platforms.linux; + mainProgram = "infer"; + }; +} diff --git a/pkgs/development/ocaml-modules/pyml/default.nix b/pkgs/development/ocaml-modules/pyml/default.nix index dc7f13cbcb5a..29cd59bbb01c 100644 --- a/pkgs/development/ocaml-modules/pyml/default.nix +++ b/pkgs/development/ocaml-modules/pyml/default.nix @@ -9,19 +9,15 @@ buildDunePackage (finalAttrs: { pname = "pyml"; - version = "20231101"; + version = "20250807"; src = fetchFromGitHub { owner = "ocamllibs"; repo = "pyml"; tag = finalAttrs.version; - hash = "sha256-0Yy5T/S3Npwt0XJmEsdXGg5AXYi9vV9UG9nMSzz/CEc="; + hash = "sha256-WPtmj9EEs7P72OXWJg1syIrbLuh7u4V4W4nyozXmSa0="; }; - patches = [ - ./remove-stdcompat.patch - ]; - buildInputs = [ utop ]; @@ -37,6 +33,7 @@ buildDunePackage (finalAttrs: { ]; strictDeps = true; + __structuredAttrs = true; doCheck = true; diff --git a/pkgs/development/ocaml-modules/pyml/remove-stdcompat.patch b/pkgs/development/ocaml-modules/pyml/remove-stdcompat.patch deleted file mode 100644 index 5d8bdb739f59..000000000000 --- a/pkgs/development/ocaml-modules/pyml/remove-stdcompat.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/pyml_stubs.c b/pyml_stubs.c -index 40e3481..e7826f1 100644 ---- a/pyml_stubs.c -+++ b/pyml_stubs.c -@@ -11,7 +11,6 @@ - #include - #include - #include --#include - #include - #include "pyml_stubs.h"