Hey folks, I make extensive use of
nix-shell --run "pytest --foo --bar" style commands when using
shell.nix files. I’ve recently switched to flakes for one of my projects. Now, I’d like to set up CI to run code formatting. Previously I would set up a CI action that runs
nix-shell --run "ruff format .". What’s the appropriate way to do this with
Through some poking around I’ve found
nix develop --command, but it only works on executables, so no arguments, no command chaining, and so forth.
nix shell nixpkgs#package -c package --help i believe is what you’re looking for
Thanks @pbsds ! I’m surprised that
nix develop --command ruff --version
nix develop --command "ruff --version"
Is this intentional?
Think so. The old interface took a single arg which it then split, while the new interface takes multiple args which can be passed directly to the subprocess. Less parsing, more secure
How does one run the equivalent of
nix-shell --run "foo && bar" in that case?
nix shell nixpkgs#package -c bash -c “foo && bar”