about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-09-07T18·09+0200
committerEelco Dolstra <edolstra@gmail.com>2017-09-07T18·09+0200
commit2e9b7c4cb2168f0aac8948d3212e50726b37acdd (patch)
tree9136f05509cf8834bbad6aaf4afa7a9bcbb11fb1 /src
parentdff440aab32131b3459cadc2c4cc60c6f42674c6 (diff)
nix run: Add some examples
Diffstat (limited to 'src')
-rw-r--r--src/nix/run.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nix/run.cc b/src/nix/run.cc
index 64a5cbd304d2..31c3c1464f1c 100644
--- a/src/nix/run.cc
+++ b/src/nix/run.cc
@@ -70,6 +70,24 @@ struct CmdRun : InstallablesCommand
         return "run a shell in which the specified packages are available";
     }
 
+    Examples examples() override
+    {
+        return {
+            Example{
+                "To start a shell providing GNU Hello from NixOS 17.03:",
+                "nix run -f channel:nixos-17.03 hello"
+            },
+            Example{
+                "To start a shell providing youtube-dl from your 'nixpkgs' channel:",
+                "nix run nixpkgs.youtube-dl"
+            },
+            Example{
+                "To run GNU Hello:",
+                "nix run nixpkgs.hello -c hello --greeting 'Hi everybody!'"
+            },
+        };
+    }
+
     void run(ref<Store> store) override
     {
         auto outPaths = toStorePaths(store, Build);