depot/third_party/nixpkgs/pkgs/development/interpreters/bats/default.nix
Default email ae91cbe6cc Project import generated by Copybara.
GitOrigin-RevId: 536fe36e23ab0fc8b7f35c24603422eee9fc17a2
2021-02-05 18:12:51 +01:00

38 lines
1,011 B
Nix

{ stdenv, lib, fetchzip, bash, makeWrapper, coreutils, gnugrep, doCheck ? true }:
stdenv.mkDerivation rec {
pname = "bats";
version = "1.2.1";
src = fetchzip {
url = "https://github.com/bats-core/bats-core/archive/v${version}.tar.gz";
hash = "sha256-grB/rJaDU0fuw4Hm3/9nI2px8KZnSWqRjTJPd7Mmb7s=";
};
nativeBuildInputs = [ makeWrapper ];
patchPhase = ''
patchShebangs .
'';
installPhase = ''
./install.sh $out
wrapProgram $out/bin/bats --suffix PATH : "${lib.makeBinPath [ bash coreutils gnugrep ]}"
'';
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
'';
meta = with lib; {
homepage = "https://github.com/bats-core/bats-core";
description = "Bash Automated Testing System";
maintainers = with maintainers; [ abathur ];
license = licenses.mit;
platforms = platforms.unix;
};
}