From ead398b8350374189bba8bd087f5bcdc783e9d44 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:16:11 +0200 Subject: [PATCH] bash: use latest ble.sh version Use fzf for completion again Fix starship with newest ble.sh version, eval a second time after ble.sh --- modules/terminal-life/bash/default.nix | 8 +++++++- modules/terminal-life/fzf/default.nix | 5 +---- overlays/blesh.nix | 27 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index c8d4eace..3d0c7311 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -34,7 +34,7 @@ in { # Syntax highlighting, auto suggestions, vim modes, etc. # https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs - source "$(blesh-share)" --attach=none + source "$(blesh-share)"/ble.sh --attach=none # ctrl + space to accept autocomplete suggestion ble-bind -m 'auto_complete' -f 'C-@' 'auto_complete/insert-on-end' # Meta (Alt) + Backspace to delete a word @@ -59,6 +59,7 @@ in { } blehook/eval-after-load complete my/complete-load-hook + bleopt exec_elapsed_mark= bleopt exec_errexit_mark= bleopt filename_ls_colors="$LS_COLORS" @@ -84,6 +85,11 @@ in { fi # end of .bashrc + # Somehow we need to ensure starship starts later than ble.sh + # (possible packaging issue?) + # https://github.com/akinomyoga/ble.sh/issues/333 + eval "$(${pkgs.starship}/bin/starship init bash)" + [[ ''${BLE_VERSION-} ]] && ble-attach ''; diff --git a/modules/terminal-life/fzf/default.nix b/modules/terminal-life/fzf/default.nix index 88e60592..372e768d 100644 --- a/modules/terminal-life/fzf/default.nix +++ b/modules/terminal-life/fzf/default.nix @@ -10,8 +10,5 @@ "--color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062" "--color=marker:#ef9062,fg+:#303030,prompt:#e5c463,hl+:#7accd7" ]; - # Use ble.sh for completions, see - # modules/terminal-life/bash/default.nix -> bleopt complete_menu_style=desc - # and https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion - enableBashIntegration = false; + enableBashIntegration = true; } diff --git a/overlays/blesh.nix b/overlays/blesh.nix index f3c93d73..f29c29ec 100644 --- a/overlays/blesh.nix +++ b/overlays/blesh.nix @@ -1,5 +1,32 @@ final: prev: { blesh = prev.blesh.overrideAttrs (oldAttrs: rec { inherit (prev.sources.blesh-nvfetcher) version src; + + dontBuild = false; + buildInputs = [prev.git]; + patchPhase = '' + substituteInPlace GNUmakefile \ + --replace "git submodule update --init --recursive" "" + ''; + nativeCheckInputs = oldAttrs.nativeCheckInputs ++ [prev.busybox]; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/share/blesh/lib" + + cat <"$out/share/blesh/lib/_package.sh" + _ble_base_package_type=nix + + function ble/base/package:nix/update { + echo "Ble.sh is installed by Nix. You can update it there." >&2 + return 1 + } + EOF + + make install INSDIR=$out/share/blesh + + runHook postInstall + ''; }); }