2021-02-05 17:12:51 +00:00
|
|
|
{ stdenv, lib, fetchzip, bash, makeWrapper, coreutils, gnugrep, doCheck ? true }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bats";
|
2021-02-05 17:12:51 +00:00
|
|
|
version = "1.2.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://github.com/bats-core/bats-core/archive/v${version}.tar.gz";
|
2021-02-05 17:12:51 +00:00
|
|
|
hash = "sha256-grB/rJaDU0fuw4Hm3/9nI2px8KZnSWqRjTJPd7Mmb7s=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
patchPhase = ''
|
2021-02-05 17:12:51 +00:00
|
|
|
patchShebangs .
|
|
|
|
'';
|
2020-05-03 17:38:23 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
installPhase = ''
|
|
|
|
./install.sh $out
|
|
|
|
wrapProgram $out/bin/bats --suffix PATH : "${lib.makeBinPath [ bash coreutils gnugrep ]}"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
inherit doCheck;
|
|
|
|
checkPhase = ''
|
|
|
|
# test generates file with absolute shebang dynamically
|
|
|
|
substituteInPlace test/install.bats --replace \
|
|
|
|
"/usr/bin/env bash" "${bash}/bin/bash"
|
|
|
|
bin/bats test
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/bats-core/bats-core";
|
|
|
|
description = "Bash Automated Testing System";
|
2021-02-05 17:12:51 +00:00
|
|
|
maintainers = with maintainers; [ abathur ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|