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

42 lines
1.1 KiB
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";
version = "1.3.0";
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";
hash = "sha256-+dboExOx2YELxV8Cwk9SVwk9G3p8EoP0LdaJ3o7GT6c=";
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 = ''
# TODO: cut if https://github.com/bats-core/bats-core/issues/418 allows
sed -i '/test works even if PATH is reset/a skip' test/bats.bats
2021-01-12 01:29:36 +00:00
# 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;
};
}