blob: 7d93bd4d6270e1b1e5b410d799ef5795d08fabfd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
{
lib,
stdenv,
fetchFromGitHub,
makeWrapper,
perlPackages,
}:
let
version = "2.10";
in
stdenv.mkDerivation {
pname = "cloc";
inherit version;
src = fetchFromGitHub {
owner = "AlDanial";
repo = "cloc";
rev = "v${version}";
sha256 = "sha256-B5dk22H5FeWZ+12A7iwAsJ0ORVfI1stDfue9ZgXBOg4=";
};
setSourceRoot = ''
sourceRoot=$(echo */Unix)
'';
nativeBuildInputs = [ makeWrapper ];
buildInputs = with perlPackages; [
perl
AlgorithmDiff
ParallelForkManager
RegexpCommon
];
makeFlags = [
"prefix="
"DESTDIR=$(out)"
"INSTALL=install"
];
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 = "Program that counts lines of source code";
homepage = "https://github.com/AlDanial/cloc";
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [ rycee ];
mainProgram = "cloc";
};
}
|