Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1# Dependencies (callPackage)
2{
3 lib,
4 stdenvNoCC,
5 shellcheck,
6}:
7
8# testers.shellcheck function
9# Docs: doc/build-helpers/testers.chapter.md
10# Tests: ./tests.nix
11{
12 name ? null,
13 src,
14}:
15stdenvNoCC.mkDerivation {
16 __structuredAttrs = true;
17 strictDeps = true;
18 name =
19 if name == null then
20 lib.warn "testers.shellcheck: name will be required in a future release, defaulting to run-shellcheck" "run-shellcheck"
21 else
22 "shellcheck-${name}";
23 inherit src;
24 dontUnpack = true; # Unpack phase tries to extract an archive, which we don't want to do with source trees
25 nativeBuildInputs = [ shellcheck ];
26 doCheck = true;
27 dontConfigure = true;
28 dontBuild = true;
29 checkPhase = ''
30 find "$src" -type f -print0 | xargs -0 shellcheck --source-path="$src"
31 '';
32 installPhase = ''
33 touch "$out"
34 '';
35}