From 094a08f8396c913b6023ae2bf1c6615470e7cc45 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 4 Dec 2012 17:15:32 +0100 Subject: Document new primops --- doc/manual/builtins.xml | 150 +++++++++++++++++++++++++++++++----------------- 1 file changed, 96 insertions(+), 54 deletions(-) (limited to 'doc/manual/builtins.xml') diff --git a/doc/manual/builtins.xml b/doc/manual/builtins.xml index 64d4e13ad997..9f5f4438ce55 100644 --- a/doc/manual/builtins.xml +++ b/doc/manual/builtins.xml @@ -19,7 +19,7 @@ is also available as builtins.derivation. - + abort s Abort Nix expression evaluation, print error @@ -27,7 +27,7 @@ is also available as builtins.derivation. - + builtins.add e1 e2 @@ -37,7 +37,7 @@ is also available as builtins.derivation. - + builtins.attrNames attrs @@ -55,7 +55,7 @@ attrValues = attrs: map (name: builtins.getAttr name attrs) (builtins.attrNames - + baseNameOf s Return the base name of the @@ -65,7 +65,7 @@ attrValues = attrs: map (name: builtins.getAttr name attrs) (builtins.attrNames - + builtins The attribute set builtins @@ -82,7 +82,7 @@ if builtins ? getEnv then builtins.getEnv "PATH" else "" - + builtins.compareVersions s1 s2 @@ -99,7 +99,16 @@ if builtins ? getEnv then builtins.getEnv "PATH" else "" - + + builtins.concatLists + lists + + Concatenate a list of lists into a single + list. + + + + builtins.currentSystem @@ -124,7 +133,7 @@ if builtins ? getEnv then builtins.getEnv "PATH" else "" --> - + - + derivation attrs @@ -152,7 +161,7 @@ if builtins ? getEnv then builtins.getEnv "PATH" else "" - + builtins.div e1 e2 @@ -162,7 +171,40 @@ if builtins ? getEnv then builtins.getEnv "PATH" else "" - + + builtins.elem + x xs + + Return true if a value equal to + x occurs in the list + xs, and false + otherwise. + + + + + builtins.elemAt + xs n + + Return element n from + the list xs. Elements are counted + starting from 0. A fatal error occurs in the index is out of + bounds. + + + + + builtins.filter + f xs + + Return a list consisting of the elements of + xs for which the function + f returns + true. + + + + builtins.filterSource e1 e2 @@ -214,7 +256,7 @@ stdenv.mkDerivation { - + builtins.getAttr s attrs @@ -227,7 +269,7 @@ stdenv.mkDerivation { - + builtins.getEnv s @@ -245,7 +287,7 @@ stdenv.mkDerivation { - + builtins.hasAttr s attrs @@ -259,7 +301,7 @@ stdenv.mkDerivation { - + builtins.head list @@ -270,7 +312,7 @@ stdenv.mkDerivation { - + import path @@ -290,7 +332,7 @@ stdenv.mkDerivation { built-in). Therefore, it cannot refer to variables that are in scope at the call site. For instance, if you have a calling expression - + rec { x = 123; @@ -325,7 +367,7 @@ x: x + 456 - + builtins.intersectAttrs e1 e2 @@ -334,8 +376,8 @@ x: x + 456 exist in the set e1. - - + + builtins.isAttrs e @@ -345,7 +387,7 @@ x: x + 456 - + builtins.isList e @@ -355,7 +397,7 @@ x: x + 456 - + builtins.isFunction e @@ -365,7 +407,7 @@ x: x + 456 - + builtins.isString e @@ -375,7 +417,7 @@ x: x + 456 - + builtins.isInt e @@ -385,7 +427,7 @@ x: x + 456 - + builtins.isBool e @@ -395,7 +437,7 @@ x: x + 456 - + isNull e @@ -405,12 +447,12 @@ x: x + 456 This function is deprecated; just write e == null instead. - + - + builtins.length e @@ -419,7 +461,7 @@ x: x + 456 - + builtins.lessThan e1 e2 @@ -432,7 +474,7 @@ x: x + 456 - + builtins.listToAttrs e @@ -459,7 +501,7 @@ builtins.listToAttrs - + map f list @@ -472,10 +514,10 @@ map (x: "foo" + x) [ "bar" "bla" "abc" ] evaluates to [ "foobar" "foobla" "fooabc" ]. - + - + builtins.mul e1 e2 @@ -485,7 +527,7 @@ map (x: "foo" + x) [ "bar" "bla" "abc" ] - + builtins.parseDrvName s @@ -500,7 +542,7 @@ map (x: "foo" + x) [ "bar" "bla" "abc" ] - + builtins.pathExists path @@ -533,7 +575,7 @@ in config.someSetting --> - + builtins.readFile path @@ -541,8 +583,8 @@ in config.someSetting path as a string. - - + + removeAttrs attrs list @@ -558,7 +600,7 @@ removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ] - + builtins.stringLength e @@ -568,7 +610,7 @@ removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ] - + builtins.sub e1 e2 @@ -578,7 +620,7 @@ removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ] - + builtins.substring start len s @@ -596,7 +638,7 @@ removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ] - + builtins.tail list @@ -606,7 +648,7 @@ removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ] - + throw s @@ -620,7 +662,7 @@ removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ] - + builtins.toFile name s @@ -638,7 +680,7 @@ removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ] stdenv.mkDerivation { name = "hello-2.1.1"; - + builder = builtins.toFile "builder.sh" " source $stdenv/setup @@ -657,7 +699,7 @@ stdenv.mkDerivation { }; inherit perl; } - + It is even possible for one file to refer to another, e.g., @@ -695,7 +737,7 @@ in foo - + builtins.toPath s Convert the string value @@ -708,7 +750,7 @@ in foo - + toString e Convert the expression @@ -720,7 +762,7 @@ in foo - + builtins.toXML e Return a string containing an XML representation @@ -765,7 +807,7 @@ in foo Passing information to a builder using <function>toXML</function> - + XML representation produced by <function>toXML</function> - + @@ -835,7 +877,7 @@ stdenv.mkDerivation (rec { - + builtins.trace e1 e2 @@ -846,7 +888,7 @@ stdenv.mkDerivation (rec { - + -- cgit 1.4.1