1
- { lib , stdenv , fetchzip , withQlExtractor ? null } :
1
+ { lib , stdenv , fetchzip , withExtractors ? [ ] , withPacks ? [ ] } :
2
2
3
3
stdenv . mkDerivation rec {
4
4
pname = "codeql-cli" ;
@@ -11,25 +11,30 @@ stdenv.mkDerivation rec {
11
11
12
12
src = fetchzip {
13
13
url = "https://github.com/github/codeql-cli-binaries/releases/download/v${ version } /codeql-${ platform } .zip" ;
14
- hash = "sha256-trWUSMOT7h7J5ejjp9PzhGgBS3DYsJxzcv6aYKuk8TI=" ;
14
+ hash = "sha256-trWUSMOT7h7J5ejjp9PzhGgBS3DYsJxzcv6aYKuk8TI=" ;
15
15
} ;
16
-
17
- buildInputs = if isNull withQlExtractor then [ ] else [ withQlExtractor ] ;
18
- inherit withQlExtractor ;
16
+
17
+ buildInputs = if ( lib . length withExtractors ) == 0 then [ ] else withExtractors ;
18
+ inherit withExtractors withPacks ;
19
19
20
20
installPhase = ''
21
21
# codeql directory should not be top-level, otherwise,
22
22
# it'll include /nix/store to resolve extractors.
23
23
env
24
- mkdir -p $out/{codeql,bin}
24
+ mkdir -p $out/{codeql/qlpacks ,bin}
25
25
cp -R * $out/codeql/
26
26
27
27
ln -s $out/codeql/codeql $out/bin/
28
28
29
- if [ -n "$withQlExtractor" ]; then
29
+ for extractor in $withExtractors; do
30
30
# Copy the extractor, because CodeQL doesn't follow symlinks.
31
- cp -R $withQlExtractor $out/codeql/ql
32
- fi
31
+ cp -R $extractor $out/codeql/ql
32
+ done
33
+
34
+ for pack in $withPacks ; do
35
+ # Copy the pack, because CodeQL doesn't follow symlinks.
36
+ cp -R $pack/ $out/codeql/qlpacks/
37
+ done
33
38
'' ;
34
39
35
40
0 commit comments