diff options
author | Nicolas Pierron <nicolas.b.pierron@gmail.com> | 2009-09-18 15:10:05 +0000 |
---|---|---|
committer | Nicolas Pierron <nicolas.b.pierron@gmail.com> | 2009-09-18 15:10:05 +0000 |
commit | e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241 (patch) | |
tree | 620e92c4def481fcab084b6f802410877d3acd6d /pkgs/lib/options.nix | |
parent | a727aa8d8b143a6930d4f4da7fe1ccb2fd3b6b01 (diff) | |
download | nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar.gz nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar.bz2 nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar.lz nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar.xz nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar.zst nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.zip |
Add location to declared sub-modules.
svn path=/nixpkgs/trunk/; revision=17252
Diffstat (limited to 'pkgs/lib/options.nix')
-rw-r--r-- | pkgs/lib/options.nix | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/pkgs/lib/options.nix b/pkgs/lib/options.nix index 37d092ef3c5..6aad285b7ac 100644 --- a/pkgs/lib/options.nix +++ b/pkgs/lib/options.nix @@ -27,6 +27,14 @@ rec { # options (set of sub-options declarations & definitions) }; + mapSubOptions = f: opt: + if opt ? options then + opt // { + options = map f (toList opt.options); + } + else + opt; + # Make the option declaration more user-friendly by adding default # settings and some verifications based on the declaration content (like # type correctness). @@ -68,20 +76,6 @@ rec { } else opt; - convertOptionsToModules = opt: - if opt ? options then - opt // { - options = map (decl: - let module = lib.applyIfFunction decl {}; in - if lib.isModule module then - decl - else - arg: { options = lib.applyIfFunction decl arg; } - ) opt.options; - } - else - opt; - handleOptionSets = opt: if decl ? type && decl.type.hasOptions then let @@ -119,7 +113,6 @@ rec { # override settings ensureMergeInputType ensureDefaultType - convertOptionsToModules handleOptionSets ]; |