From 4f7917ac62bb27543053056a6e4a3288ecb1809f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 13 Aug 2012 18:26:19 -0400 Subject: [PATCH] Remove obsolete flattenAttrs function --- pkgs/lib/lists.nix | 2 +- pkgs/lib/misc.nix | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pkgs/lib/lists.nix b/pkgs/lib/lists.nix index e247a27ba16..b50da022283 100644 --- a/pkgs/lib/lists.nix +++ b/pkgs/lib/lists.nix @@ -212,7 +212,7 @@ rec { let loop = l: if tail l == [] then head l else loop (tail l); in loop list; - + # Zip two lists together. zipTwoLists = xs: ys: if xs != [] && ys != [] then diff --git a/pkgs/lib/misc.nix b/pkgs/lib/misc.nix index f4a629398b5..39a3ad258b0 100644 --- a/pkgs/lib/misc.nix +++ b/pkgs/lib/misc.nix @@ -322,10 +322,6 @@ rec { // listToAttrs (map (n : nameValuePair n (a: b: "${a}\n${b}") ) [ "preConfigure" "postInstall" ]) ; - # returns atribute values as a list - flattenAttrs = set : map ( attr : builtins.getAttr attr set) (attrNames set); - mapIf = cond : f : fold ( x : l : if (cond x) then [(f x)] ++ l else l) []; - # prepareDerivationArgs tries to make writing configurable derivations easier # example: # prepareDerivationArgs { @@ -365,7 +361,7 @@ rec { flagName = name : "${name}Support"; cfgWithDefaults = (listToAttrs (map (n : nameValuePair (flagName n) false) (attrNames args2.flags))) // args2.cfg; - opts = flattenAttrs (mapAttrs (a : v : + opts = attrValues (mapAttrs (a : v : let v2 = if (v ? set || v ? unset) then v else { set = v; }; n = if (getAttr (flagName a) cfgWithDefaults) then "set" else "unset"; attr = maybeAttr n {} v2; in