Commit graph

58 commits

Author SHA1 Message Date
Eelco Dolstra 5fef92c4a0 Move pkgs/lib/ to lib/ 2013-10-10 13:28:21 +02:00
Evgeny Egorochkin 2d310a91c8 Trivial change of wording of error messages 2013-08-23 09:01:12 +03:00
Evgeny Egorochkin 993deb1a4a Hopefully a fixed version of Refactor: introduce isType reducing redundancy.
Coding-by-sed wasn't a good idea :(
2013-08-22 23:17:30 +03:00
Eelco Dolstra d28a189af6 Revert "Refactor: introduce isType reducing redundancy (trivial change)"
This reverts commit 52204af457.  It
breaks Nixpkgs evaluation.

http://hydra.nixos.org/build/5758197
2013-08-22 16:40:27 +02:00
Marc Weber 7a76598447 Improve error messages.
Improve function name: ensureDefaultType: It runs the check function, so
checkDefault is much easier to understand.
2013-08-22 11:20:57 +03:00
Marc Weber 52204af457 Refactor: introduce isType reducing redundancy (trivial change) 2013-08-22 11:10:53 +03:00
Marc Weber acd4dcde63 Always merge functions "merge" and "check" if type defines them. 2013-08-22 10:32:13 +03:00
Shea Levy 6b0d6593e8 Create a mkEnableOption function for an extremely common NixOS idiom
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-18 15:13:42 -04:00
Shea Levy 6d64b1d92c Give unique keys to submodule components
I'm not wed to the outPath values I chose, other options are probably
valid there too. It would be nice if we could track which file each
merged value came from as well.

Signed-off-by: Shea Levy <shea@shealevy.com>
2013-06-07 03:42:46 -04:00
Shea Levy d465d6764a Allow imports in submodules
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-06-06 14:00:10 -04:00
Shea Levy 2952d7d114 Merge submodule extraArgs and individualExtraArgs
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-06-05 11:20:59 -04:00
Shea Levy 888c7f2757 modules: Enable setting extraArgs for all submodules or by name
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-06-04 17:47:42 -04:00
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
Eelco Dolstra d7b4b63f4d * Allow literal examples to be included in the manual.
svn path=/nixpkgs/trunk/; revision=29024
2011-09-05 10:14:24 +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 bf010ace55 * Remove the mysterious `_args' attribute because it screws up the
manual generation (causes `nixos-rebuild build-vm' evaluation to
  fail in the `networking.ifaces' option).

svn path=/nixpkgs/trunk/; revision=22084
2010-06-01 14:24:16 +00:00
Eelco Dolstra 1ba3165b4e * Allow the default for option values displayed in the manual to be
overriden.  Some defaults should not be evaluated because they cause
  unnecessary evaluation or might cause evaluation errors
  (e.g. assertions).  For instance, the value of the
  `boot.kernelPackages' option is an attribute set.  Some packages in
  that set might not evaluate (e.g. AUFS2 on kernels that don't have
  the AUFS2 patch), and in any case it slows down nixos-rebuild to
  evaluate lots of packages that are not actually used in the
  configuration.

svn path=/nixpkgs/trunk/; revision=22043
2010-05-28 11:20:45 +00:00
Eelco Dolstra cde9d0fb13 * The old evaluator segfaults if the `outPath' attribute is missing.
Work around it for the moment.

svn path=/nixpkgs/trunk/; revision=21747
2010-05-12 13:24:09 +00:00
Eelco Dolstra 9ec34da2ee * In the generation of the `options.xml' file used to produce the
NixOS manual and  manpages, remove all derivation attributes except
  the `name' attribute.  This cuts the size of `options.xml' from 7.0
  MiB to 473 KiB, and more importantly, cuts evaluation time of the
  system derivation from 1.63s to 1.10s on my laptop (a 32%
  improvement).

svn path=/nixpkgs/trunk/; revision=21739
2010-05-12 11:07:49 +00:00
Eelco Dolstra da7e1fbea3 * Do not silently ignore broken "example" and "default" attributes
when generating the documentation.  If they're broken, they should
  be fixed.

svn path=/nixpkgs/trunk/; revision=21738
2010-05-12 09:31:46 +00:00
Ludovic Courtès 4b7ff33c26 options: Learn how to merge identical integer values.
svn path=/nixpkgs/trunk/; revision=20581
2010-03-11 22:03:49 +00:00
Ludovic Courtès 529e1900ca options: Use the built-in type predicates.
svn path=/nixpkgs/trunk/; revision=20580
2010-03-11 22:03:45 +00:00
Nicolas Pierron 233d72e4fb * Add "_args" to all sub-module configurations result. This attribute
enable argument introspection outside of the scope of each sub-module.

svn path=/nixpkgs/trunk/; revision=18240
2009-11-07 01:59:45 +00:00
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