2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, makeWrapper, perlPackages }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
let version = "2.00";
|
2023-10-09 19:29:22 +00:00
|
|
|
in stdenv.mkDerivation {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "cloc";
|
2023-10-09 19:29:22 +00:00
|
|
|
inherit version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "AlDanial";
|
|
|
|
repo = "cloc";
|
2021-05-20 23:08:51 +00:00
|
|
|
rev = "v${version}";
|
2024-02-29 20:09:43 +00:00
|
|
|
sha256 = "sha256-GZvrsVuPLg09yOlDmdHNZ0QLXoftgSYMFkn6PLf1/Pw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
setSourceRoot = ''
|
|
|
|
sourceRoot=$(echo */Unix)
|
|
|
|
'';
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2021-12-19 01:06:50 +00:00
|
|
|
buildInputs = with perlPackages; [
|
|
|
|
perl
|
|
|
|
AlgorithmDiff
|
|
|
|
ParallelForkManager
|
|
|
|
RegexpCommon
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
makeFlags = [ "prefix=" "DESTDIR=$(out)" "INSTALL=install" ];
|
|
|
|
|
|
|
|
postFixup = "wrapProgram $out/bin/cloc --prefix PERL5LIB : $PERL5LIB";
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Program that counts lines of source code";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/AlDanial/cloc";
|
2024-05-15 15:35:15 +00:00
|
|
|
license = lib.licenses.gpl2Plus;
|
2021-01-15 22:18:51 +00:00
|
|
|
platforms = lib.platforms.all;
|
|
|
|
maintainers = with lib.maintainers; [ rycee ];
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "cloc";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|