Recent concerns about the mixing of the new CLI and flakes notwithstanding, the new CLI can be seriously awesome(ly compact) if you buy into it:
$ nix run nixpkgs#cowsay moo
However, my first attempt at adding flags to the command often fails:
$ nix run nixpkgs#cowsay -t moo error: unrecognised flag '-t' Try 'nix --help' for more information.
The correct solution is to separate Nix and nested command arguments by
--. This makes sense in that Nix flags are order-independent in general, which this separation preserves. However, I’d like to argue that in the case of
nix run, convenience should win over consistency with other commands so as to interpret all flags given after the installable as non-Nix flags. It would be extremely convenient, and consistent in a different way, if I could run any cmdline of a program in Nixpkgs by prefixing it with
nix run nixpkgs# irrespective of the cmdline flags involved. Furthermore, I can’t think of any reason to ever specify Nix flags after the installable except to confuse other people.
What do y’all think?