From 5d769de8a34474f4e76911927118312b69b47136 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 5 Oct 2006 09:08:52 +0000 Subject: * Document --arg. --- doc/manual/opt-common.xml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'doc/manual/opt-common.xml') diff --git a/doc/manual/opt-common.xml b/doc/manual/opt-common.xml index 04cda15310fb..d9c29a19e11e 100644 --- a/doc/manual/opt-common.xml +++ b/doc/manual/opt-common.xml @@ -217,6 +217,46 @@ + name value + + This option is accepted by + nix-env, nix-instantiate and + nix-build. When evaluating Nix expressions, the + expression evaluator will automatically try to call functions that + it encounters. It can automatically call functions for which every + argument has a default value (e.g., + {argName ? + defaultValue}: + ...). With + , you can also call functions that have + arguments without a default value (or override a default value). + That is, if the evaluator encounters a function with an argument + named name, it will call it with value + value. + + For instance, the file + pkgs/top-level/all-packages.nix in Nixpkgs is + actually a function: + + +{ # The system (e.g., `i686-linux') for which to build the packages. + system ? __currentSystem + ... +}: ... + + So if you call this Nix expression (e.g., when you do + nix-env -i pkgname), + the function will be called automatically using the value __currentSystem + for the system argument. You can override this + using , e.g., nix-env -i + pkgname --arg system + \"i686-freebsd\". (Note that since the argument is a Nix + string literal, you have to escape the quotes.) + + + + -- cgit 1.4.1