about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/bash
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/bash')
-rw-r--r--nixpkgs/pkgs/development/libraries/bash/bash-preexec/default.nix45
1 files changed, 45 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/bash/bash-preexec/default.nix b/nixpkgs/pkgs/development/libraries/bash/bash-preexec/default.nix
new file mode 100644
index 000000000000..fe8f63c685c4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/bash/bash-preexec/default.nix
@@ -0,0 +1,45 @@
+{ stdenvNoCC, lib, fetchFromGitHub, bats }:
+
+let version = "0.4.1";
+in stdenvNoCC.mkDerivation {
+  pname = "bash-preexec";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "rcaloras";
+    repo = "bash-preexec";
+    rev = version;
+    sha256 = "062iigps285628p710i7vh7kmgra5gahq9qiwj7rxir167lg0ggw";
+  };
+
+  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
+
+    # 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
+  '';
+
+  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;
+  };
+}