@jayesh.bhoot I think a better breakdown would look like this:
| use | old command | new command |
|---|---|---|
start a new shell that has ripgrep available |
nix-shell -p ripgrep |
nix shell nixpkgs#ripgrep |
start a new shell that has the dependencies required for building ripgrep available (like gcc and rustc) |
nix-shell -A ripgrep |
nix develop nixpkgs#ripgrep |
build ripgrep completely within Nix. Put the resulting binary in a result/ symlink |
nix-build -A ripgrep |
nix build nixpkgs#ripgrep |
| run an application defined in a flake | nothing similar? | nix run nixpkgs#ripgrep |
A couple things to keep in mind:
-
nix build,nix develop, andnix runhave special support for flakes. For instance, if there is aflake.nixin the current directory, then:-
nix buildwith no arguments will try to build theoutputs.defaultPackage. -
nix developwith no arguments will load the shell defined inoutputs.devShell. -
nix runwith no arugments will run the command defined inoutputs.defaultApp.
-
-
You might be able to make the argument that
nix runis similar tonix-shell -p ripgrep --run 'ripgrep', but this is somewhat of a stretch. -
nix shellmay be renamed: Rename 'nix shell' · Issue #4715 · NixOS/nix · GitHub