Commit graph

34 commits

Author SHA1 Message Date
Nicolas Pierron bbb4ce1dd7 Extract the path done inside the iteration process of the option type and
give it as argument to each sub-module.

With the type "types.attrsOf types.optionSet", you will obtain the name of
the attribute in which the sub-modules are contained.

svn path=/nixpkgs/trunk/; revision=17669
2009-10-06 09:21:46 +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 6041b78fa4 Report bad default values which would have cause a build failure if they
were used to build a NixOS system.

svn path=/nixpkgs/trunk/; revision=17286
2009-09-19 22:10:11 +00:00
Nicolas Pierron 5f138aebde Fix: Use the check function defined in the option declaration if it exists.
svn path=/nixpkgs/trunk/; revision=17277
2009-09-19 16:49:31 +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
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 b09382fcd1 Extract properties.nix and modules.nix from options.nix.
svn path=/nixpkgs/trunk/; revision=16339
2009-07-13 16:18:52 +00:00
Nicolas Pierron 5cd8eefb26 Allow to set priority which are below the default priority level.
This help to define default values which can be override without any extra syntax.

svn path=/nixpkgs/trunk/; revision=16304
2009-07-10 09:44:09 +00:00
Nicolas Pierron aec4341cb4 Fix: (in moduleClosure) remove key attribute of inlined sets.
svn path=/nixpkgs/trunk/; revision=16198
2009-07-06 23:20:14 +00:00
Nicolas Pierron c49dddb1ab Substitute fixOptionSetsFun by multiple functions which are:
- well named,
- capable to handle the proposal of Eelco Dolstra { imports= [..]; options = {}; config = {}; } in addition to the current { require = [..]; .. } syntax.

svn path=/nixpkgs/trunk/; revision=16192
2009-07-06 16:20:05 +00:00
Nicolas Pierron a89f3bca50 allow the argument set of modules to be defined outside of option.nix file.
svn path=/nixpkgs/trunk/; revision=16191
2009-07-06 16:20:00 +00:00
Eelco Dolstra a440fba8e3 * Refactoring: move the types out of options.nix, which is much too
big.  Also, they could be useful beyond option handling.

svn path=/nixpkgs/trunk/; revision=16055
2009-06-26 13:53:31 +00:00
Nicolas Pierron dd50af4923 Add a description of values which cause a bad type the failure.
svn path=/nixpkgs/trunk/; revision=16054
2009-06-26 12:42:00 +00:00
Nicolas Pierron 6c0912ee9c - partition based on the content of the properties. (rmProperties * isOption)
- Do not eval properties on option declarations.
  -> mkIf does not mask option declarations if the condition is evaluated to false.

svn path=/nixpkgs/trunk/; revision=16043
2009-06-25 21:25:33 +00:00
Eelco Dolstra 36b4a9b3f3 * Rename types.enable -> types.bool.
svn path=/nixpkgs/trunk/; revision=15955
2009-06-14 11:06:16 +00:00
Nicolas Pierron 6f0b3b683e option types: Fix the generated template name used for the documentation.
svn path=/nixpkgs/trunk/; revision=15938
2009-06-11 16:03:43 +00:00
Nicolas Pierron 8f8971144f optionAttrSetToDocList: Re-implement with the collect function.
Use the option name computed by "handleOptionSets" instead of
computing it a second time.  Handle option containing option sets.

svn path=/nixpkgs/trunk/; revision=15937
2009-06-11 16:03:38 +00:00
Nicolas Pierron b32002c3a3 Add support for a new module syntax.
Introduce optional argument to optionSet options.

svn path=/nixpkgs/trunk/; revision=15935
2009-06-11 16:03:26 +00:00
Eelco Dolstra ac7eb7d25a * nix-env gets confused when an attrset contains an attribute named
"type".

svn path=/nixpkgs/trunk/; revision=15781
2009-05-29 09:47:55 +00:00
Nicolas Pierron 49b4942f0e Add option types.
svn path=/nixpkgs/trunk/; revision=15749
2009-05-27 20:25:17 +00:00
Eelco Dolstra ded055c896 * Remove an attrset comparison.
svn path=/nixpkgs/trunk/; revision=15736
2009-05-26 16:25:59 +00:00
Eelco Dolstra 8b52e84e1a * Fix a comparison of function values (disallowed in the Nix trunk).
Thanks to Nicolas.

svn path=/nixpkgs/trunk/; revision=15734
2009-05-26 16:00:30 +00:00
Marc Weber f7f938a1d1 big breaking change: renaming lib.getAttr to lib.attrByPath
getAttr was ambiguous. It's also a builtin function

fix

svn path=/nixpkgs/trunk/; revision=15692
2009-05-24 10:57:41 +00:00
Nicolas Pierron 1500252e6f * options.nix:
Remove attribute set comparison.  Imported attribute sets
        are traverse assuming that no duplicate could exists.

svn path=/nixpkgs/trunk/; revision=15659
2009-05-19 23:07:07 +00:00
Nicolas Pierron 47679b20af Remove unused feature which allowed to add properties on the required elements.
svn path=/nixpkgs/trunk/; revision=15658
2009-05-19 23:07:02 +00:00
Nicolas Pierron 36dcabd7be Add support for require attribute with a filename as argument.
svn path=/nixpkgs/trunk/; revision=15657
2009-05-19 23:06:56 +00:00
Eelco Dolstra b9d560d30e * Get rid of __primop.
* newMergeOptionSets -> mergeOptionSets.

svn path=/nixpkgs/trunk/; revision=15652
2009-05-19 14:54:41 +00:00
Nicolas Pierron f624a70ee7 Fix mkThenElse and mkAlways evaluation.
svn path=/nixpkgs/trunk/; revision=14528
2009-03-14 07:20:31 +00:00
Nicolas Pierron e18a10d0ae * Refactor mkIf to extract the concept of properties.
Properties can be delay on any attribute set and have
functions which are used to define the semantic of each
property.

* Introduce the mkOverride property.

svn path=/nixpkgs/trunk/; revision=14285
2009-02-28 18:21:25 +00:00
Eelco Dolstra 599015e8b0 * Split lib/default.nix into several files, as it had become a big
mess.  Also cleaned up some functions:

  - foldl appeared broken (it recursively called fold).
  - Renamed logicalAND/logicalOR to and/or.
  - Removed listOfListsToAttrs, eqStrings: obsolete.
  - Removed isInList, which does the same thing as elem.
  - stringToCharacters: don't return a "" at the end of the list.
  - Renamed concatList to concat, as concatList (singular) is a
    misnomer: it takes two lists.  Likewise, renamed mergeAttr to
    mergeAttrs.

  misc.nix still contains a lot of stuff that should be refactored and
  moved to other files.

svn path=/nixpkgs/trunk/; revision=14013
2009-02-09 16:51:03 +00:00
Eelco Dolstra b5f893d92a * Moved the functions for option processing to lib.
svn path=/nixpkgs/trunk/; revision=9616
2007-11-09 18:05:32 +00:00
Marc Weber 2a8bb1725d fix: listToAttr takes name instead of attr as argument
svn path=/nixpkgs/trunk/; revision=9599
2007-11-07 21:45:12 +00:00
Eelco Dolstra d897fc5501 * Some prototype code to make dealing with options in Nixpkgs/NixOS
easier.  Instead of writing

    config.get ["foo" "bar"]

  it would be much cleaner to just write

    config.foo.bar

  only this doesn't handle the case where option foo.bar is not
  supplied in the configuration; in that case we need to take the
  default value from some set of option definitions
  (system/options.nix in NixOS).

  Following a suggestion from Martin, the function `combine' (need
  better name) takes a set of option definitions (which follow the
  attribute set structure of the options) and a set of options and
  fills in missing values in the latter with default values from the
  former.  This only works with very recent versions of Nix (it needs
  Marc Weber's listToAttrs primop).

svn path=/nixpkgs/trunk/; revision=9203
2007-08-27 15:10:48 +00:00