biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / misc / cloc / default.nix
blob39215caa63a5f2ff6b0e8bc6bcc924c4ab9487cb
1 { lib, stdenv, fetchFromGitHub, makeWrapper, perlPackages }:
3 let version = "2.02";
4 in stdenv.mkDerivation {
5   pname = "cloc";
6   inherit version;
8   src = fetchFromGitHub {
9     owner = "AlDanial";
10     repo = "cloc";
11     rev = "v${version}";
12     sha256 = "sha256-qTrBCCC2J8Ewt6GvYlnXU8F1iB31A1xTFXdkee8L0Os=";
13   };
15   setSourceRoot = ''
16     sourceRoot=$(echo */Unix)
17   '';
19   nativeBuildInputs = [ makeWrapper ];
20   buildInputs = with perlPackages; [
21     perl
22     AlgorithmDiff
23     ParallelForkManager
24     RegexpCommon
25   ];
27   makeFlags = [ "prefix=" "DESTDIR=$(out)" "INSTALL=install" ];
29   postFixup = "wrapProgram $out/bin/cloc --prefix PERL5LIB : $PERL5LIB";
31   doInstallCheck = true;
32   installCheckPhase = ''
33     runHook preInstallCheck
35     echo -n 'checking --version...'
36     $out/bin/cloc --version | grep '${version}' > /dev/null
37     echo ' ok'
39     cat > test.nix <<EOF
40     {a, b}: {
41       test = a
42         + b;
43     }
44     EOF
46     echo -n 'checking lines in test.nix...'
47     $out/bin/cloc --quiet --csv test.nix | grep '1,Nix,0,0,4' > /dev/null
48     echo ' ok'
50     runHook postInstallCheck
51   '';
53   meta = {
54     description = "Program that counts lines of source code";
55     homepage = "https://github.com/AlDanial/cloc";
56     license = lib.licenses.gpl2Plus;
57     platforms = lib.platforms.all;
58     maintainers = with lib.maintainers; [ rycee ];
59     mainProgram = "cloc";
60   };