Adding programs to PATH: Difference between revisions
m Put commands into code blocks Tags: Mobile edit Mobile web edit Visual edit |
m Put commands into code blocks Tags: Mobile edit Mobile web edit Visual edit |
||
| Line 39: | Line 39: | ||
=== Ad-hoc shell using <code>nix-shell -p</code> === | === Ad-hoc shell using <code>nix-shell -p</code> === | ||
Run the following command to create a new shell with the <code>hello</code> package from Nixpkgs. | Run the following command to create a new shell with the <code>hello</code> package from Nixpkgs.<syntaxhighlight lang="shell-session"> | ||
[username@hostname:~]$ nix-shell -p hello | |||
[nix-shell:~]$ hello | |||
Hello, world! | |||
[nix-shell:~]$ | |||
</syntaxhighlight>{{Expand|reason=Compare <code>nix-shell -p</code> and <code>nix shell</code>. If I remember correctly, the former uses <code>pkgs.mkShell</code> and supports expressions and hooks (i.e. for extra environment variables).}} | |||
=== Ad-hoc shell using <code>nix shell</code> (Flakes) === | === Ad-hoc shell using <code>nix shell</code> (Flakes) === | ||