nix-shell
Installation
SKILL.md
nix-shell
When you want to execute a command but it's not in your PATH, you can use nix shell or nix run to create a temporary environment. nix shell will create a new shell with the specified packages available, while nix run will run a command directly without a shell.
Before using nix shell or nix run, you may want to figure out which packages you need for your command. User will have nix in their system with package index available. You can use nix-locate to search for packages. For example:
nix-locate /bin/w | rg "/bin/w\$" # to find the package that provides /bin/w
After finding the package, you can use nix shell to create a temporary environment with that package available, or nix run to run the command directly. For example, to use ffmpeg:
# using nix shell
nix shell nixpkgs#ffmpeg
ffmpeg <params>
Related skills