1{ lib
2, stdenvNoCC
3, fetchzip
4, runtimeShell
5, bashInteractive
6, glibcLocales
7}:
8
9stdenvNoCC.mkDerivation rec {
10 pname = "blesh";
11 version = "0.3.4";
12
13 src = fetchzip {
14 url = "https://github.com/akinomyoga/ble.sh/releases/download/v${version}/ble-${version}.tar.xz";
15 sha256 = "sha256-MGCQirZvqGfjTTsbDfihY2il/u2suWBaZ6dX8mF1zLk=";
16 };
17
18 dontBuild = true;
19
20 doCheck = true;
21 nativeCheckInputs = [ bashInteractive glibcLocales ];
22 preCheck = "export LC_ALL=en_US.UTF-8";
23
24 installPhase = ''
25 runHook preInstall
26
27 mkdir -p "$out/share/blesh/lib"
28
29 cat <<EOF >"$out/share/blesh/lib/_package.sh"
30 _ble_base_package_type=nix
31
32 function ble/base/package:nix/update {
33 echo "Ble.sh is installed by Nix. You can update it there." >&2
34 return 1
35 }
36 EOF
37
38 cp -rv $src/* $out/share/blesh
39
40 runHook postInstall
41 '';
42
43 postInstall = ''
44 mkdir -p "$out/bin"
45 cat <<EOF >"$out/bin/blesh-share"
46 #!${runtimeShell}
47 # Run this script to find the ble.sh shared folder
48 # where all the shell scripts are living.
49 echo "$out/share/blesh"
50 EOF
51 chmod +x "$out/bin/blesh-share"
52 '';
53
54 meta = with lib; {
55 homepage = "https://github.com/akinomyoga/ble.sh";
56 description = "Bash Line Editor -- a full-featured line editor written in pure Bash";
57 license = licenses.bsd3;
58 maintainers = with maintainers; [ aiotter ];
59 platforms = platforms.unix;
60 };
61}