dotfiles/hosts/modules/bashistrans.nix

28 lines
891 B
Nix
Raw Permalink Normal View History

2025-10-06 09:30:18 +10:00
{pkgs, ...}: {
# I want to use fish as my login shell but it always goes terrible
# cause it isn't POSIX compliant, so instead Bash is my login and
# will just exec fish (^-^)
2026-01-31 08:37:39 +10:00
programs = {
fish.enable = true;
2025-10-06 09:30:18 +10:00
2026-01-31 08:37:39 +10:00
bash = {
blesh.enable = false; # ble.sh replacement for GNU readline
completion.enable = true;
interactiveShellInit = ''
# help bash transition into a beautiful fish!
if [[ -z $CRY_BASH_IS_TRANS ]]
2025-10-06 09:30:18 +10:00
then
2026-01-31 08:37:39 +10:00
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
2025-10-06 09:30:18 +10:00
fi
2026-01-31 08:37:39 +10:00
# bash is trans now! (no more transitioning required)
export CRY_BASH_IS_TRANS=true
'';
};
2025-10-06 09:30:18 +10:00
};
}