nixpkgs/pkgs/build-support/testers/shellcheck/tester.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
692 B
Nix
Raw Normal View History

# Dependencies (callPackage)
{ lib, stdenv, shellcheck }:
# testers.shellcheck function
# Docs: doc/build-helpers/testers.chapter.md
# Tests: ./tests.nix
{ src }:
let
inherit (lib) fileset pathType isPath;
in
stdenv.mkDerivation {
name = "run-shellcheck";
src =
if isPath src && pathType src == "regular" # note that for strings this would have been IFD, which we prefer to avoid
then fileset.toSource { root = dirOf src; fileset = src; }
else src;
nativeBuildInputs = [ shellcheck ];
doCheck = true;
dontConfigure = true;
dontBuild = true;
checkPhase = ''
find . -type f -print0 \
| xargs -0 shellcheck
'';
installPhase = ''
touch $out
'';
}