nixpkgs/pkgs/development/interpreters/bats/default.nix

39 lines
1011 B
Nix
Raw Normal View History

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