Closed bbjubjub2494 closed 1 year ago
Having this same issue :sweat_smile: I'll look into fixing it and make a PR.
Ok so there's two options:
nix run $toplevel#$attrs -- <args>
nix shell $toplevel#$attrs --command <command>
Personally I prefer the second option, because you'd occasionally have no application defined in the output for "$attrs", which trips up run
; but with shell
it adds the package to the PATH and then runs whatever comes after --command
. Additionally, it allows to use it in conjunction with other programs in a pipe and such.
I'd recommend the latter with -c
instead of --command
(just because it takes up less space).
That's fair! I usually like presenting the longer options so new people can understand it more easily at a glance, but they can always run --help
at some point later on
Yeah I'm usually a long options defender, but in this case I think teaching people there's a syntax short enough to want to type is valuable. It also reduces confusion with the nix-shell(1)
--command
option which works slightly differently.
That's fair, we should go with -c
then! :grin:
On a flakified system, the interactive shell CNF handler responds with something like
It does not appear as though
--command
is a flag fornix run
.nix shell
however has such a flag, so the message could benix shell nixpkgs#farbfeld.out --command ...
OS: NixOS 22.05 Nix: 2.8.1, 2.9.1