1{ lib, stdenv, fetchzip, zlib, xorg, freetype, jdk11, curl }:
2
3stdenv.mkDerivation rec {
4 pname = "codeql";
5 version = "2.11.0";
6
7 dontConfigure = true;
8 dontBuild = true;
9 dontStrip = true;
10
11 src = fetchzip {
12 url = "https://github.com/github/codeql-cli-binaries/releases/download/v${version}/codeql.zip";
13 sha256 = "sha256-nY31/coUnBNkKg10SOd64sBBkV44g+eIXyKIrPq1IWU=";
14 };
15
16 nativeBuildInputs = [
17 zlib
18 xorg.libX11
19 xorg.libXext
20 xorg.libXi
21 xorg.libXtst
22 xorg.libXrender
23 freetype
24 jdk11
25 stdenv.cc.cc.lib
26 curl
27 ];
28
29 installPhase = ''
30 # codeql directory should not be top-level, otherwise,
31 # it'll include /nix/store to resolve extractors.
32 mkdir -p $out/{codeql,bin}
33 cp -R * $out/codeql/
34
35 ln -sf $out/codeql/tools/linux64/lib64trace.so $out/codeql/tools/linux64/libtrace.so
36
37 sed -i 's%\$CODEQL_DIST/tools/\$CODEQL_PLATFORM/java%\${jdk11}%g' $out/codeql/codeql
38
39 ln -s $out/codeql/codeql $out/bin/
40 '';
41
42 meta = with lib; {
43 description = "Semantic code analysis engine";
44 homepage = "https://codeql.github.com";
45 maintainers = [ maintainers.dump_stack ];
46 platforms = lib.platforms.linux ++ lib.platforms.darwin;
47 license = licenses.unfree;
48 };
49}