From 498a242bf4b4ad8aaf5624bd19602b7676766af8 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Sat, 26 Jan 2019 22:34:06 -0500 Subject: [PATCH] nixpkgs/manual: add trivial builders section Fixes #25507. --- doc/functions.xml | 1 + doc/functions/trivial-builders.xml | 84 ++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 doc/functions/trivial-builders.xml diff --git a/doc/functions.xml b/doc/functions.xml index 0dc32bbc5bd..0d6e2770e6e 100644 --- a/doc/functions.xml +++ b/doc/functions.xml @@ -12,6 +12,7 @@ + diff --git a/doc/functions/trivial-builders.xml b/doc/functions/trivial-builders.xml new file mode 100644 index 00000000000..4fbe8883610 --- /dev/null +++ b/doc/functions/trivial-builders.xml @@ -0,0 +1,84 @@ +
+ Trivial builders + + + There are a couple of functions provide in Nixpkgs that help with + building derivations. The most important one, + stdenv.mkDerivation, has already been + documented above. These wrap + stdenv.mkDerivation, making it easier to use + in certain cases. + + + + + + runCommand + + + + This takes three arguments, name, + env, and buildCommand. + name is just the name that Nix will use to + refer to the derivation. env is an attribute + set specifying environment variables that will be set for this + derivation. 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. + + + + + + runCommandCC + + + + This works just like runCommand. The only + difference is that it also provides a C compiler for your use. + To minimize your dependencies, you should only use this if you + are sure you will need a C compiler as part of running your command. + + + + + + writeTextFile + + + + This writes text to the Nix store. This is + useful for creating scripts from Nix expressions. This takes an + attribute set and expects two arguments, + name and text. + name corresponds to the name used in the Nix + store path. text will be the contents of the + file. You can also set executable to true to + make this file have the executable bit set. + + + + + + symlinkJoin + + + + This can be used to put many derivations into the same directory + structure. It works by creating a new derivation and adding + symlinks to each of the paths listed. It expects two arguments, + name, and paths. + name is the name used in the Nix store path + for the created derivation. paths is a list of + paths that will be symlinked. These paths can be to Nix store + derivations or any other directory. + + + + + +