Adding programs to PATH: Difference between revisions

Axka (talk | contribs)
m Put commands into code blocks
Tags: Mobile edit Mobile web edit Visual edit
Axka (talk | contribs)
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


<code>nix-shell -p hello</code>{{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).}}
[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) ===