3
0
Fork 0
forked from mirrors/nixpkgs
Commit graph

36 commits

Author SHA1 Message Date
Eelco Dolstra 0b4fb4e4f6 Replace some calls to attrByPath with "or" 2012-08-13 15:15:16 -04:00
Eelco Dolstra c0a483632c Eliminate some calls to ‘tail’ 2012-08-13 15:15:16 -04:00
Nicolas Pierron 8a67709183 Add mkMerge and obsolete mkThenElse.
svn path=/nixpkgs/trunk/; revision=33796
2012-04-15 23:31:48 +00:00
Nicolas Pierron 02677481ae modules (moduleClosure): use imap instead of map to produce uniq keys for
the genericClosure.

svn path=/nixpkgs/trunk/; revision=27014
2011-04-27 18:41:37 +00:00
Eelco Dolstra 798a6bb103 * Typo.
svn path=/nixpkgs/trunk/; revision=24288
2010-10-14 13:55:08 +00:00
Eelco Dolstra 415cf4cd1c * Omit the "Defined by:" elements in the configuration.nix section of
the manual.  While it's a useful feature, it has the unfortunate
  side-effect of causing the manual to be rebuilt every time the user
  adds an option definition to any module (including
  configuration.nix), and rebuilding the manual is rather slow.

svn path=/nixpkgs/trunk/; revision=23110
2010-08-11 11:46:09 +00:00
Eelco Dolstra 5564bd2635 * Make stack traces more consistent.
svn path=/nixpkgs/trunk/; revision=21652
2010-05-07 15:13:43 +00:00
Eelco Dolstra 21358e7ad0 * Support require/imports in top-level anonymous configurations,
i.e. the elements of initModules that are not paths.
* Support a "key" attribute in anonymous configurations to allow
  lazyGenericClosure to distinguish between them.

svn path=/nixpkgs/trunk/; revision=19240
2010-01-05 17:04:55 +00:00
Nicolas Pierron 88f113d032 * Add a function to replace "pkgs.checker". The function checkModule does a
traversal of all definitions and also check definitions contained inside
  sub-modules.

svn path=/nixpkgs/trunk/; revision=18241
2009-11-07 01:59:50 +00:00
Nicolas Pierron 09bed4bffc * Report file locations in the stack-trace when multiple option
declarations cannot be merged.

svn path=/nixpkgs/trunk/; revision=18149
2009-11-05 16:36:03 +00:00
Nicolas Pierron 5684506470 * Add isDefined to each options. This will clean-up NixOS introspection.
svn path=/nixpkgs/trunk/; revision=18147
2009-11-05 15:39:39 +00:00
Nicolas Pierron b15cbb639e Refactor a bit to add names to intermediate computations. Add a cross
temporary result to fetch information from the evaluation to make them
available inside the option declaration.

Add: isNotDefined flag inside the option.

svn path=/nixpkgs/trunk/; revision=17766
2009-10-12 17:51:21 +00:00
Nicolas Pierron 81694a7f54 * modules.nix: use catAttrs function instead of hand made code.
svn path=/nixpkgs/trunk/; revision=17760
2009-10-12 15:50:59 +00:00
Nicolas Pierron 19648abc05 Revert previous commit because this is implicit. Fix property evaluation
error which arose when one module define a value with "mkDefaultValue"
and another module define its value with "mkIf <false>".

svn path=/nixpkgs/trunk/; revision=17759
2009-10-12 15:16:22 +00:00
Nicolas Pierron e82843144c do not delay mkOverride on options which are does not have sub modules.
svn path=/nixpkgs/trunk/; revision=17758
2009-10-12 15:07:31 +00:00
Nicolas Pierron 03eab95618 Only allow properties with a onGlobalEval function to go through specific
types.

svn path=/nixpkgs/trunk/; revision=17756
2009-10-12 13:37:00 +00:00
Nicolas Pierron 926f20a1ee Revert "* Revert the last two commits ..." (rev 17738) & Fix.
svn path=/nixpkgs/trunk/; revision=17740
2009-10-09 23:03:24 +00:00
Eelco Dolstra 24b50e92ee * Revert the last two commits since they break every job in the
buildfarm ("undefined variable `delayPropertiesTemplate'").

svn path=/nixpkgs/trunk/; revision=17738
2009-10-09 19:34:28 +00:00
Nicolas Pierron bb16a7f08d Replace a counter intuitive behaviour of module evaluations.
- types.nix:
Introduce a new flag named "delayProperties" which define either that
properties should be evaluated (when false) or that they should be delaied
through the type structure.

- properties.nix:
Generalized the delayProperties function to make it work with the iter
functions of option types.

- modules.nix:
Replace evalProperties by a condition based on the value of the
"delayProperties" flag of the option type.  If the flag does not exists or
if it is false, then the system behaves as always.  Otherwise it delays
the properties from the current value to each values contained inside it.

svn path=/nixpkgs/trunk/; revision=17736
2009-10-09 18:11:30 +00:00
Nicolas Pierron fd0396037a extract function unifyOptionModule from moduleMerge. This function is
used to convert option sets, provided inside option declarations, to a
module.

svn path=/nixpkgs/trunk/; revision=17735
2009-10-09 18:11:24 +00:00
Nicolas Pierron c3d328ca48 Fix sub-module argument manipulation: Avoid using an empty set to check
the type of the module.

svn path=/nixpkgs/trunk/; revision=17666
2009-10-06 09:21:17 +00:00
Nicolas Pierron 4c43afbaf6 export definitions to be used in conjunctions with extraConfigs. With such
method, properties evaluated at the evaluation time are still on the values
which makes this interresting to use in conjunction with extraConfigs.
The extraConfigs values are merged with the other values and then the
properties gets evaluated.

Thus, we can keep properties like mkOverride with this method.

svn path=/nixpkgs/trunk/; revision=17482
2009-09-28 18:22:55 +00:00
Nicolas Pierron 33d43ac18b Add extraConfigs attribute inside options. This attribute is used to
insert definitions from an external location.  As opposed to other
defintions, these definitions are always embedded into a list which allow
to add multiple definitions with one module.

!!! This feature _should not_ be used as a new mean to define options.

svn path=/nixpkgs/trunk/; revision=17481
2009-09-28 18:22:49 +00:00
Nicolas Pierron b0f639844a the tryEval builtin does not have a strict evaluation. Add the toXML
builtin to force the evaluation of the configuration value.  Thus the
success flag returned by tryEval corespond to the success of the
whole evaluation.

svn path=/nixpkgs/trunk/; revision=17478
2009-09-28 18:22:31 +00:00
Nicolas Pierron fad1b41fe4 externals argumental are now taking precedence over the result of
moduleMerge because we may need to alter the result of the configuration
before using it inside other options.

svn path=/nixpkgs/trunk/; revision=17477
2009-09-28 18:22:24 +00:00
Nicolas Pierron 13f467fc84 Remove values coming from the original sources because this may cause the evaluation of unsafe code.
Instead add the computed value under tryEval to catch bad evaluations.

svn path=/nixpkgs/trunk/; revision=17453
2009-09-26 23:01:35 +00:00
Eelco Dolstra 1885909e93 * More typos.
svn path=/nixpkgs/trunk/; revision=17257
2009-09-18 15:18:23 +00:00
Nicolas Pierron c6267a8c9d Add declarations and definitions to options. This allow you to retrieve
the location of the definition with the defined value.

Filter the source location for the documentation.

svn path=/nixpkgs/trunk/; revision=17253
2009-09-18 15:10:11 +00:00
Nicolas Pierron e07f5d2a2c Add location to declared sub-modules.
svn path=/nixpkgs/trunk/; revision=17252
2009-09-18 15:10:05 +00:00
Eelco Dolstra d7d80e8fdc * Typos.
svn path=/nixpkgs/trunk/; revision=17182
2009-09-16 11:37:07 +00:00
Nicolas Pierron 0c16b00cbd Replace the traversal of modules:
- Remove handleOptionSets which used option declarations & definitions
in the same set.
- Add a traversal of modules where "config" and "options" are traverse at
the same time.

This allow to have accruate error messages with the incriminated files
playing a role in the error.

This system add a new restriction compare to the previous system:
- A module with no structure (option definitions & option declarations
& require) should not contain any option declarations.  If such module
exists you must convert it to the following form:

{ imports = <content of the require attribute>;
  options = <set of option declarations>;
  config = <set of option definitions>;
}

svn path=/nixpkgs/trunk/; revision=17163
2009-09-15 13:36:30 +00:00
Nicolas Pierron 37ce2ca949 Handles cases where developers ""cannot"" put their initial modules in
other files.

Imports of imported attribute set are not working anymore because this
feature is hard to maintain and because this a potential source of error.

Imports are only accepted inside named modules where the system has some
control over mutual inclusion.

svn path=/nixpkgs/trunk/; revision=17144
2009-09-15 00:21:39 +00:00
Michael Raskin b98b622ef0 Fix NixOS evaluation. As I understand, configuration gets added to the list of modules as an attrSet (not as a file name). Just add a trivial check to passthrough such modules.
svn path=/nixpkgs/trunk/; revision=17116
2009-09-14 20:10:41 +00:00
Nicolas Pierron 1557cfd0c6 split moduleClosure in two parts:
* unifyModuleSyntax: handle all kind of module syntax to convert them into
  a module which has the following form:

  {
    imports = [ <paths> ];
    options = <attribute set of options declarations>;
    config = <attribute set (with properties) of option definitions>;
  }

  This function assume that there is at most one imported attribute set which
  correspond to option declarations.

* moduleClosure: handle a list of module's paths which are converted with
  the previous function to do the closure of the imports with the function
  lazyGenericClosure (which does the same as builtins.genericClosure except
  that it doesn't evaluate the content of modules).  The "key" and "paths"
  attributes are left to be used as debug information in futur
  implementation(s).

svn path=/nixpkgs/trunk/; revision=17108
2009-09-14 13:19:00 +00:00
Eelco Dolstra 80cab44fce * Options / config: these should be attrsets, not lists (IMHO).
svn path=/nixpkgs/trunk/; revision=16359
2009-07-14 16:22:42 +00:00
Nicolas Pierron b09382fcd1 Extract properties.nix and modules.nix from options.nix.
svn path=/nixpkgs/trunk/; revision=16339
2009-07-13 16:18:52 +00:00