Merge pull request #255916 from fricklerhandwerk/doc-runcommand

rewrite `runCommand` interface docs

authored by Robert Hensing and committed by GitHub 2999014a c53164b1

+19 -2
+19 -2
doc/builders/trivial-builders.chapter.md
··· 4 4 5 5 ## `runCommand` {#trivial-builder-runCommand} 6 6 7 - This takes three arguments, `name`, `env`, and `buildCommand`. `name` is just the name that Nix will append to the store path in the same way that `stdenv.mkDerivation` uses its `name` attribute. `env` is an attribute set specifying environment variables that will be set for this derivation. These attributes are then passed to the wrapped `stdenv.mkDerivation`. `buildCommand` specifies the commands that will be run to create this derivation. Note that you will need to create `$out` for Nix to register the command as successful. 7 + `runCommand :: String -> AttrSet -> String -> Derivation` 8 + 9 + `runCommand name drvAttrs buildCommand` returns a derivation that is built by running the specified shell commands. 8 10 9 - An example of using `runCommand` is provided below. 11 + `name :: String` 12 + : The name that Nix will append to the store path in the same way that `stdenv.mkDerivation` uses its `name` attribute. 13 + 14 + `drvAttr :: AttrSet` 15 + : Attributes to pass to the underlying call to [`stdenv.mkDerivation`](#chap-stdenv). 16 + 17 + `buildCommand :: String` 18 + : Shell commands to run in the derivation builder. 19 + 20 + ::: {.note} 21 + You have to create a file or directory `$out` for Nix to be able to run the builder successfully. 22 + ::: 23 + 24 + ::: {.example #ex-runcommand-simple} 25 + # Invocation of `runCommand` 10 26 11 27 ```nix 12 28 (import <nixpkgs> {}).runCommand "my-example" {} '' ··· 28 44 date 29 45 '' 30 46 ``` 47 + ::: 31 48 32 49 ## `runCommandCC` {#trivial-builder-runCommandCC} 33 50