3 ms·
Another fun thing you could do (I'm not saying it's a good idea) with nix-shell is this: install command-not-found and set this function in your shell comm
by rnhmjoj 3y ago
Another fun thing you could do (I'm not saying it's a good idea) with nix-shell is this: install command-not-found and set this function in your shell
command_not_found_handle() {
eval "$(command-not-found $1 2>&1 | sed -n 3p) --run '$@'"
}
Now you have any command available, no matter if installed or not.
- lambdaba 3y agoNice. There's also "comma" (https://github.com/nix-community/comma https://github.com/nix-community/comma) that allows running any executable from nixpkgs by prepending ",".
- EnergyAmy 3y agoThanks for posting that, that looks super useful. A lot of my nix-shell usage is one-off commands like this
- exe34 3y agoThis is disgusting, I love it!
- gipp 3y agoI actually did do this on my personal machine. Works pretty well tbh. Of course you have to worry about accidentally starting some install (or, just evaluation and fetching I guess) process every time you have a typo in your command, but that'll be obvious immediately and you just Ctrl c out of it. Still waiting for it to bite me somehow but hasn't yet