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

39 lines
1011 B
Nix
Raw Normal View History

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 {
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 .
'';
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
'';
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; {
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;
};
}