Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / interpreters / bats / default.nix
blob01d1b61cb8017642f578a81b3f0d797aa7989f30
1 { stdenv, lib, fetchzip, bash, makeWrapper, coreutils, gnugrep, doCheck ? true }:
3 stdenv.mkDerivation rec {
4   pname = "bats";
5   version = "1.3.0";
7   src = fetchzip {
8     url = "https://github.com/bats-core/bats-core/archive/v${version}.tar.gz";
9     hash = "sha256-+dboExOx2YELxV8Cwk9SVwk9G3p8EoP0LdaJ3o7GT6c=";
10   };
12   nativeBuildInputs = [ makeWrapper ];
14   patchPhase = ''
15     patchShebangs .
16   '';
18   installPhase = ''
19     ./install.sh $out
20     wrapProgram $out/bin/bats --suffix PATH : "${lib.makeBinPath [ bash coreutils gnugrep ]}"
21   '';
23   inherit doCheck;
24   checkPhase = ''
25     # TODO: cut if https://github.com/bats-core/bats-core/issues/418 allows
26     sed -i '/test works even if PATH is reset/a skip' test/bats.bats
28     # test generates file with absolute shebang dynamically
29     substituteInPlace test/install.bats --replace \
30       "/usr/bin/env bash" "${bash}/bin/bash"
31     bin/bats test
32   '';
34   meta = with lib; {
35     homepage = "https://github.com/bats-core/bats-core";
36     description = "Bash Automated Testing System";
37     maintainers = with maintainers; [ abathur ];
38     license = licenses.mit;
39     platforms = platforms.unix;
40   };