From 17afc42895a586d6eefa76583c55022261b0d923 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 7 Sep 2017 20:14:04 +0200 Subject: [PATCH] nix build: Add examples --- src/nix/build.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/nix/build.cc b/src/nix/build.cc index 4240f06ad..42b3e42c6 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) override { auto buildables = toBuildables(store, dryRun ? DryRun : Build);