Introducing Crash, a user-configurable login shell wrapper that enhances your command line experience. With Crash, you can easily switch between multiple shells defined in your SHELLS environment variable, ensuring you never get locked out. Perfect for collaborative environments or for those exploring new, unstable shells—it’s the flexible fallback you need.
Crash is a highly efficient and user-configurable login shell wrapper designed for flexibility and ease of use. It allows users to specify a sequence of shell executables through the SHELLS
environment variable, executing them in order and halting when one exits successfully (returning a 0 exit code).
Key Features
-
Customizable User Shells: Empower users to configure their own shells without the need for superuser access. Set the
SHELLS
variable to custom paths, such as.config/shell
, and enable users to change shell preferences easily. -
Hotswap Shells: Seamlessly switch between different shell environments while using SSH. This feature is particularly useful for multi-user scenarios on shared accounts, where different users might prefer different shell setups. Check out the "Tips & Tricks" section to enhance your SSH experience with Crash.
-
Reliable Fallback Mechanism: Prevent potential lockouts by defining a fallback shell. If the preferred shell fails to launch, Crash will automatically revert to a predefined fallback shell, such as
bashInteractive
, making it perfect for users exploring new or unstable shells like Nushell.
Usage Overview
To implement Crash, simply load the repository into your inputs:
{
inputs.crash.url = "github:RGBCube/crash";
}
Then, configure your desired shells in the NixOS module:
{
environment.sessionVariables.SHELLS = "${lib.getExe pkgs.nushell}:${lib.getExe pkgs.fish}";
}
For users compiling without Nix, use the following command:
zig build --release=safe -Dcpu=baseline -Dfallback_shell=/bin/<yourshell>
Tips & Tricks
Maximize your workflow by controlling the default shell launched through SSH. Make OpenSSH recognize the SHELLS
environment variable:
{
services.openssh = {
enable = true;
settings.AcceptEnv = "SHELLS";
};
}
Then configure your .ssh/config
:
Host myvps
SetEnv SHELLS=fish:nu:bash:dash
Common Issues
One common pitfall is using the tilde (~
) for home directory references in the SHELLS
variable. Remember, it won’t expand. Instead, use relative paths:
SHELLS=.config/shell # This WILL work!
Conclusion
Crash provides a powerful, flexible solution for managing your login shells, ensuring you maintain accessibility and ease of configuration without requiring elevated privileges. Whether you're managing a shared environment or exploring new shell options, Crash has you covered. Explore the repository to learn more about how you can enhance your shell experience!