Nix (command): Difference between revisions

imported>Mic92
imported>Mic92
add nix build examples
Line 21: Line 21:


=== <code>nix build</code>  ===
=== <code>nix build</code>  ===
==== Usage ====
nix build FLAGS... INSTALLABLES...
   
   
build a derivation or fetch a store path
==== Description ====
Build a derivation or fetch a store path
 
=== Examples ====
 
To build and run GNU Hello from NixOS 20.03:
 
<syntaxHighlight lang=console>
  $ nix build -f channel:nixos-20.03 hello; ./result/bin/hello
</syntaxHighlight>
 
To build the build.x86_64-linux attribute from release.nix:
 
<syntaxHighlight lang=console>
  $ nix build -f release.nix build.x86_64-linux
</syntaxHighlight>
 
To make a profile point at GNU Hello (what is a profile?)


<syntaxHighlight lang=console>
  $ nix build --profile /tmp/profile 'nixpkgs#hello'
</syntaxHighlight>


===  <code>nix develop</code> ===
===  <code>nix develop</code> ===