1{ lib, stdenv, fetchzip, zlib, xorg, freetype, jdk17, curl }:
2
3stdenv.mkDerivation rec {
4 pname = "codeql";
5 version = "2.13.3";
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-CYc/tFjDFXFlSY4/ykM7OR8HsUbYQUHL5IfGYw7to4k=";
14 };
15
16 nativeBuildInputs = [
17 zlib
18 xorg.libX11
19 xorg.libXext
20 xorg.libXi
21 xorg.libXtst
22 xorg.libXrender
23 freetype
24 jdk17
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-aarch64%\${jdk17}%g' $out/codeql/codeql
38 sed -i 's%\$CODEQL_DIST/tools/\$CODEQL_PLATFORM/java%\${jdk17}%g' $out/codeql/codeql
39
40 ln -s $out/codeql/codeql $out/bin/
41 '';
42
43 meta = with lib; {
44 description = "Semantic code analysis engine";
45 homepage = "https://codeql.github.com";
46 maintainers = [ maintainers.dump_stack ];
47 platforms = lib.platforms.linux ++ lib.platforms.darwin;
48 license = licenses.unfree;
49 };
50}