mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
3fb14db08a
Needed for testing upcoming commit.
29 lines
692 B
Nix
29 lines
692 B
Nix
# 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
|
|
'';
|
|
}
|