Files
nixpkgs/pkgs/by-name/cl/cloc/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

74 lines
1.4 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
makeWrapper,
perlPackages,
}:
let
version = "2.06";
in
stdenv.mkDerivation {
pname = "cloc";
inherit version;
src = fetchFromGitHub {
owner = "AlDanial";
repo = "cloc";
rev = "v${version}";
sha256 = "sha256-u/qIkoN8xFA/aggjbSfVHbhUvRo6fWqcJWSMO/Q0hQo=";
};
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";
};
}