about summary refs log tree commit diff
path: root/pkgs/development/libraries/sharness/default.nix
blob: 43a102686e9c22367f461839f24f17a4fbe1c344 (plain) (blame)
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
{ stdenv
, lib
, fetchFromGitHub
, fetchurl
, perl
, perlPackages
, sharnessExtensions ? {} }:

stdenv.mkDerivation rec {
  pname = "sharness";
  version = "1.1.0-dev";

  src = fetchFromGitHub {
    owner = "chriscool";
    repo = pname;
    rev = "3f238a740156dd2082f4bd60ced205e05894d367"; # 2020-12-09
    sha256 = "FCYskpIqkrpNaWCi2LkhEkiow4/rXLe+lfEWNUthLUg=";
  };

  # Used for testing
  nativeBuildInputs = [ perl perlPackages.IOTty ];

  outputs = [ "out" "doc" ];

  makeFlags = [ "prefix=$(out)" ];

  extensions = lib.mapAttrsToList (k: v: "${k}.sh ${v}") sharnessExtensions;

  postInstall = lib.optionalString (sharnessExtensions != {}) ''
    extDir=$out/share/sharness/sharness.d
    mkdir -p "$extDir"
    linkExtensions() {
      set -- $extensions
      while [ $# -ge 2 ]; do
        ln -s "$2" "$extDir/$1"
        shift 2
      done
    }
    linkExtensions
  '';

  doCheck = true;

  meta = with lib; {
    description = "Portable shell library to write, run and analyze automated tests adhering to Test Anything Protocol (TAP)";
    homepage = "https://github.com/chriscool/sharness";
    license = licenses.gpl2Only;
    maintainers = [ maintainers.spacefrogg ];
    platforms = platforms.unix;
  };
}