about summary refs log tree commit diff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-09-07T18·14+0200
committerEelco Dolstra <edolstra@gmail.com>2017-09-07T18·14+0200
commit17afc42895a586d6eefa76583c55022261b0d923 (patch)
tree413aebd2fca3651b3b2cf001febb712acfe9cdab /src/nix
parent2e9b7c4cb2168f0aac8948d3212e50726b37acdd (diff)
nix build: Add examples
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/build.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nix/build.cc b/src/nix/build.cc
index 4240f06ade7d..42b3e42c69e1 100644
--- a/src/nix/build.cc
+++ b/src/nix/build.cc
@@ -35,6 +35,20 @@ struct CmdBuild : MixDryRun, InstallablesCommand
         return "build a derivation or fetch a store path";
     }
 
+    Examples examples() override
+    {
+        return {
+            Example{
+                "To build and run GNU Hello from NixOS 17.03:",
+                "nix build -f channel:nixos-17.03 hello; ./result/bin/hello"
+            },
+            Example{
+                "To build the build.x86_64-linux attribute from release.nix:",
+                "nix build -f release.nix build.x86_64-linux"
+            },
+        };
+    }
+
     void run(ref<Store> store) override
     {
         auto buildables = toBuildables(store, dryRun ? DryRun : Build);