diff options
author | Nicolas Pierron <nicolas.b.pierron@gmail.com> | 2009-09-28 18:22:49 +0000 |
---|---|---|
committer | Nicolas Pierron <nicolas.b.pierron@gmail.com> | 2009-09-28 18:22:49 +0000 |
commit | 33d43ac18bd9178e5222433f3ef7e58a3a35f173 (patch) | |
tree | 1c29bf0bf2f79fe231f7c8338bd1fe380405f567 /pkgs/lib/options.nix | |
parent | b3b40ebf791156abba529b2e50678f8958e284c3 (diff) | |
download | nixpkgs-33d43ac18bd9178e5222433f3ef7e58a3a35f173.tar nixpkgs-33d43ac18bd9178e5222433f3ef7e58a3a35f173.tar.gz nixpkgs-33d43ac18bd9178e5222433f3ef7e58a3a35f173.tar.bz2 nixpkgs-33d43ac18bd9178e5222433f3ef7e58a3a35f173.tar.lz nixpkgs-33d43ac18bd9178e5222433f3ef7e58a3a35f173.tar.xz nixpkgs-33d43ac18bd9178e5222433f3ef7e58a3a35f173.tar.zst nixpkgs-33d43ac18bd9178e5222433f3ef7e58a3a35f173.zip |
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
Diffstat (limited to 'pkgs/lib/options.nix')
-rw-r--r-- | pkgs/lib/options.nix | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/pkgs/lib/options.nix b/pkgs/lib/options.nix index c1c6a64d6d5..6f1b1afe12a 100644 --- a/pkgs/lib/options.nix +++ b/pkgs/lib/options.nix @@ -25,6 +25,7 @@ rec { # merge (function used to merge definitions into one definition: [ /type/ ] -> /type/) # apply (convert the option value to ease the manipulation of the option result) # options (set of sub-options declarations & definitions) + # extraConfigs (list of possible configurations) }; mapSubOptions = f: opt: @@ -138,14 +139,17 @@ rec { assert opt1 ? merge -> ! opt2 ? merge; assert opt1 ? apply -> ! opt2 ? apply; assert opt1 ? type -> ! opt2 ? type; - if opt1 ? options || opt2 ? options then - opt1 // opt2 // { + opt1 // opt2 + // optionalAttrs (opt1 ? options || opt2 ? options) { options = (toList (attrByPath ["options"] [] opt1)) ++ (toList (attrByPath ["options"] [] opt2)); } - else - opt1 // opt2 + // optionalAttrs (opt1 ? extraConfigs || opt2 ? extraConfigs) { + extraConfigs = + (attrByPath ["extraConfigs"] [] opt1) + ++ (attrByPath ["extraConfigs"] [] opt2); + } )) {} opts; |