2021-01-12 01:29:36 +00:00
|
|
|
{ stdenv, lib, fetchzip, bash, makeWrapper, coreutils, gnugrep, doCheck ? true }:
|
2016-02-07 11:11:31 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "bats";
|
2021-01-12 01:29:36 +00:00
|
|
|
version = "1.2.1";
|
2016-02-07 11:11:31 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
2018-08-23 20:14:59 +01:00
|
|
|
url = "https://github.com/bats-core/bats-core/archive/v${version}.tar.gz";
|
2021-01-12 01:29:36 +00:00
|
|
|
hash = "sha256-grB/rJaDU0fuw4Hm3/9nI2px8KZnSWqRjTJPd7Mmb7s=";
|
2016-02-07 11:11:31 +00:00
|
|
|
};
|
|
|
|
|
2021-01-12 01:29:36 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
2018-10-27 14:18:53 +01:00
|
|
|
patchPhase = ''
|
2021-01-12 01:29:36 +00:00
|
|
|
patchShebangs .
|
|
|
|
'';
|
2020-05-02 10:46:37 +01:00
|
|
|
|
2021-01-12 01:29:36 +00:00
|
|
|
installPhase = ''
|
|
|
|
./install.sh $out
|
|
|
|
wrapProgram $out/bin/bats --suffix PATH : "${lib.makeBinPath [ bash coreutils gnugrep ]}"
|
2018-10-27 14:18:53 +01:00
|
|
|
'';
|
2016-03-01 00:19:27 +00:00
|
|
|
|
2021-01-12 01:29:36 +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
|
|
|
|
'';
|
2016-02-07 11:11:31 +00:00
|
|
|
|
2021-01-12 01:29:36 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/bats-core/bats-core";
|
2016-02-07 11:11:31 +00:00
|
|
|
description = "Bash Automated Testing System";
|
2021-01-12 01:29:36 +00:00
|
|
|
maintainers = with maintainers; [ abathur ];
|
2016-02-07 11:11:31 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|