devshell
devshell copied to clipboard
Allow wrapping and variable interpolation in `help` in the devshell menu
Based on #290
Interpolation
There's a .env
file not added to git.
ADDRESS="http://localhost:3000"
A devshell
user would like to open the address in a browser.
She can write this expression.
devShells.default = devshell.mkShell {
bash.extra = ''
set -a
source .env
'';
devshell.menu.interpolate = true;
commands = [
{
package = "hello"; help = "open $ADDRESS";
}
];
};
And get this devshell menu.
🔨 Welcome to devshell
[[general commands]]
hello - open http://localhost:3000
menu - prints this menu
[devshell]$
Wrapping
The default devshell looks like this:
🔨 Welcome to devshell
[[general commands]]
menu - prints this menu
[packages]
diffutils-3.10 - Commands for showing the differences between
files (diff, cmp, etc.)
goreleaser-1.23.0 - Deliver Go binaries as fast and easily as
possible
[scripts]
nix fmt - format Nix files
nix run .#bench - Run benchmark
nix run .#docs - Run mdBook server at "http://localhost:3000"
[utilites]
golangci-lint-1.55.2 - golang linter
hub-unstable-2022-12-01 - GitHub utility
[devshell]$
Hmm, what can be the error on macOS?
UPD: it was due to longer than devshell.menu.width
lines on macOS
@zimbatm, @blaggacao, please, review
Although this is not a moderated repository. Recent Moderation Team actions has scared me away from the Nix Community.
I'm sorry, won't be available for review. This has nothing to do with you and your effort which is really commendable. Keep the spirit up!