Nix (command): Difference between revisions

imported>Mic92
Add nix flake subcommands
imported>Mic92
nix build: move to own page
Line 20: Line 20:
== Main commands ==
== Main commands ==


=== <code>nix build</code> ===
=== [[Nix_command/build|nix build]] ===
 
==== Usage ====
 
<syntaxHighlight lang=console>
$ nix build FLAGS... INSTALLABLES...
</syntaxHighlight>
 
==== 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> ===