3
0
Fork 0
forked from mirrors/nixpkgs

Fix style

This commit is contained in:
Eelco Dolstra 2013-10-23 17:50:55 +02:00
parent ec0911ce7f
commit 0ec10c57df

View file

@ -1,4 +1,6 @@
{pkgs, options, config, ...}: { config, pkgs, options, ... }:
with pkgs.lib;
let let
@ -24,8 +26,7 @@ let
abort "Deprecated option `${from}' is defined instead of `${to}'."; abort "Deprecated option `${from}' is defined instead of `${to}'.";
}; };
zipModules = list:
zipModules = list: with pkgs.lib;
zipAttrsWith (n: v: zipAttrsWith (n: v:
if tail v != [] then if tail v != [] then
if n == "_type" then (head v) if n == "_type" then (head v)
@ -36,7 +37,7 @@ let
else head v else head v
) list; ) list;
rename = statusTemplate: from: to: with pkgs.lib; rename = statusTemplate: from: to:
let let
status = statusTemplate from to; status = statusTemplate from to;
setTo = setAttrByPath (splitString "." to); setTo = setAttrByPath (splitString "." to);
@ -46,21 +47,20 @@ let
fromOf = attrByPath (splitString "." from) fromOf = attrByPath (splitString "." from)
(abort "Internal error: option `${from}' should be declared."); (abort "Internal error: option `${from}' should be declared.");
in in
[{ [ { options = setFrom (mkOption {
options = setFrom (mkOption { description = "${status.name} of <option>${to}</option>.";
description = "${status.name} of <option>${to}</option>."; apply = x: status.msg.use (toOf config);
apply = x: status.msg.use (toOf config); visible = false;
visible = false; });
}); }
}] ++ { options = setTo (mkOption {
[{ extraConfigs =
options = setTo (mkOption { let externalDefs = (fromOf options).definitions; in
extraConfigs = if externalDefs == [] then []
let externalDefs = (fromOf options).definitions; in else map (def: def.value) (status.msg.define externalDefs);
if externalDefs == [] then [] });
else map (def: def.value) (status.msg.define externalDefs); }
}); ];
}];
in zipModules ([] in zipModules ([]