2021-09-15 23:03:56 +01:00
|
|
|
{ stdenvNoCC, lib, fetchFromGitHub, bats }:
|
|
|
|
|
2022-04-22 04:37:15 +01:00
|
|
|
let version = "0.5.0";
|
2021-09-15 23:03:56 +01:00
|
|
|
in stdenvNoCC.mkDerivation {
|
|
|
|
pname = "bash-preexec";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rcaloras";
|
|
|
|
repo = "bash-preexec";
|
|
|
|
rev = version;
|
2022-04-22 04:37:15 +01:00
|
|
|
sha256 = "sha256-+FU5n7EkY78X5nUiW3WN9+6Bf6oiPjsG2MSRCleooFs=";
|
2021-09-15 23:03:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
checkInputs = [ bats ];
|
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
doCheck = true;
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
# Needed since the tests expect that HISTCONTROL is set.
|
|
|
|
sed -i '/setup()/a HISTCONTROL=""' test/bash-preexec.bats
|
2021-11-01 22:44:51 +00:00
|
|
|
|
|
|
|
# Skip tests failing with Bats 1.5.0.
|
|
|
|
# See https://github.com/rcaloras/bash-preexec/issues/121
|
|
|
|
sed -i '/^@test.*IFS/,/^}/d' test/bash-preexec.bats
|
2021-09-15 23:03:56 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
bats test
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -Dm755 $src/bash-preexec.sh $out/share/bash/bash-preexec.sh
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "preexec and precmd functions for Bash just like Zsh";
|
|
|
|
license = licenses.mit;
|
|
|
|
homepage = "https://github.com/rcaloras/bash-preexec";
|
|
|
|
maintainers = [ maintainers.hawkw maintainers.rycee ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|