@@ -0,0 +1,41 @@
1+{ stdenvNoCC, lib, fetchFromGitHub, bats }:
2+
3+let version = "0.4.1";
4+in stdenvNoCC.mkDerivation {
5+ pname = "bash-preexec";
6+ inherit version;
7+
8+ src = fetchFromGitHub {
9+ owner = "rcaloras";
10+ repo = "bash-preexec";
11+ rev = version;
12+ sha256 = "062iigps285628p710i7vh7kmgra5gahq9qiwj7rxir167lg0ggw";
13+ };
14+
15+ checkInputs = [ bats ];
16+
17+ dontConfigure = true;
18+ doCheck = true;
19+ dontBuild = true;
20+
21+ patchPhase = ''
22+ # Needed since the tests expect that HISTCONTROL is set.
23+ sed -i '/setup()/a HISTCONTROL=""' test/bash-preexec.bats
24+ '';
25+
26+ checkPhase = ''
27+ bats test
28+ '';
29+
30+ installPhase = ''
31+ install -Dm755 $src/bash-preexec.sh $out/share/bash/bash-preexec.sh
32+ '';
33+
34+ meta = with lib; {
35+ description = "preexec and precmd functions for Bash just like Zsh";
36+ license = licenses.mit;
37+ homepage = "https://github.com/rcaloras/bash-preexec";
38+ maintainers = [ maintainers.hawkw maintainers.rycee ];
39+ platforms = platforms.unix;
40+ };
41+}