about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/cloc/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/cloc/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/misc/cloc/default.nix29
1 files changed, 26 insertions, 3 deletions
diff --git a/nixpkgs/pkgs/tools/misc/cloc/default.nix b/nixpkgs/pkgs/tools/misc/cloc/default.nix
index e89e785e9bdc..a8fc4a4f01b8 100644
--- a/nixpkgs/pkgs/tools/misc/cloc/default.nix
+++ b/nixpkgs/pkgs/tools/misc/cloc/default.nix
@@ -1,14 +1,15 @@
 { lib, stdenv, fetchFromGitHub, makeWrapper, perlPackages }:
 
-stdenv.mkDerivation rec {
+let version = "1.98";
+in stdenv.mkDerivation {
   pname = "cloc";
-  version = "1.96";
+  inherit version;
 
   src = fetchFromGitHub {
     owner = "AlDanial";
     repo = "cloc";
     rev = "v${version}";
-    sha256 = "sha256-20vL+SX8Tbp6QxErDn76c6sLWnB1IJwHlQX4YAvj+Eg=";
+    sha256 = "sha256-OTzIzLgE9sdbHZUSARSbVrxD95dW8gPiM8tvMvqm1Bg=";
   };
 
   setSourceRoot = ''
@@ -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";