From 5d769de8a34474f4e76911927118312b69b47136 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 5 Oct 2006 09:08:52 +0000 Subject: [PATCH] * Document --arg. --- doc/manual/nix-build.xml | 8 ++++++ doc/manual/nix-env.xml | 15 +--------- doc/manual/nix-instantiate.xml | 1 + doc/manual/opt-common-syn.xml | 1 + doc/manual/opt-common.xml | 40 ++++++++++++++++++++++++++ doc/manual/writing-nix-expressions.xml | 3 +- 6 files changed, 53 insertions(+), 15 deletions(-) diff --git a/doc/manual/nix-build.xml b/doc/manual/nix-build.xml index 5ec6237b0..e26f9b1af 100644 --- a/doc/manual/nix-build.xml +++ b/doc/manual/nix-build.xml @@ -9,6 +9,8 @@ nix-build + + name value drvlink @@ -56,6 +58,12 @@ or renamed. So don’t rename the symlink. Options +See also . All options not +listed here are passed to nix-store --realise, +except for and / + which are passed to +nix-instantiate. + diff --git a/doc/manual/nix-env.xml b/doc/manual/nix-env.xml index ee228f374..5aa38c81c 100644 --- a/doc/manual/nix-env.xml +++ b/doc/manual/nix-env.xml @@ -10,6 +10,7 @@ nix-env + name value @@ -24,7 +25,6 @@ path - system @@ -106,19 +106,6 @@ linkend="sec-common-options" />. - - - By default, when you install a derivation with the - operation, it will replace previously - installed versions with the same derivation name (regardless of - the version number). This option causes those previously - installed versions to be kept in the new generation of the - profile. Note that this will generally cause conflicts in the - creation of the user environment (since multiple versions of a - package typically contain the same programs). - - - system By default, operations such as + 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.) + + + + diff --git a/doc/manual/writing-nix-expressions.xml b/doc/manual/writing-nix-expressions.xml index 41b172310..2294fc69a 100644 --- a/doc/manual/writing-nix-expressions.xml +++ b/doc/manual/writing-nix-expressions.xml @@ -1387,7 +1387,8 @@ if builtins ? getEnv then __getEnv "PATH" else "" - currentSystem + builtins.currentSystem The built-in value currentSystem evaluates to the Nix platform identifier for the Nix installation