cloc: add basic install check

This commit is contained in:
Robert Helgesson 2023-08-23 10:34:30 +02:00
parent 06b2bae611
commit f297ac8a4d

View file

@ -1,8 +1,9 @@
{ lib, stdenv, fetchFromGitHub, makeWrapper, perlPackages }:
stdenv.mkDerivation rec {
let version = "1.98";
in stdenv.mkDerivation {
pname = "cloc";
version = "1.98";
inherit version;
src = fetchFromGitHub {
owner = "AlDanial";
@ -27,6 +28,28 @@ stdenv.mkDerivation rec {
postFixup = "wrapProgram $out/bin/cloc --prefix PERL5LIB : $PERL5LIB";
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
echo -n 'checking --version...'
$out/bin/cloc --version | grep '${version}' > /dev/null
echo ' ok'
cat > test.nix <<EOF
{a, b}: {
test = a
+ b;
}
EOF
echo -n 'checking lines in test.nix...'
$out/bin/cloc --quiet --csv test.nix | grep '1,Nix,0,0,4' > /dev/null
echo ' ok'
runHook postInstallCheck
'';
meta = {
description = "A program that counts lines of source code";
homepage = "https://github.com/AlDanial/cloc";