From 0ae8b365b35fa1c3cac700ce34b37012f96d7deb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Jul 2015 17:41:35 +0200 Subject: [PATCH] Rename misc.nix -> deprecated.nix --- lib/attrsets.nix | 3 +-- lib/default.nix | 2 +- lib/{misc.nix => deprecated.nix} | 2 -- lib/options.nix | 1 - lib/strings.nix | 2 ++ lib/trivial.nix | 2 +- 6 files changed, 5 insertions(+), 7 deletions(-) rename lib/{misc.nix => deprecated.nix} (99%) diff --git a/lib/attrsets.nix b/lib/attrsets.nix index d81d69b14025..20be2002402c 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -6,7 +6,6 @@ with { inherit (import ./default.nix) fold; inherit (import ./strings.nix) concatStringsSep; inherit (import ./lists.nix) concatMap concatLists all deepSeqList; - inherit (import ./misc.nix) maybeAttr; }; rec { @@ -86,7 +85,7 @@ rec { foldAttrs = op: nul: list_of_attrs: fold (n: a: fold (name: o: - o // (listToAttrs [{inherit name; value = op n.${name} (maybeAttr name nul a); }]) + o // (listToAttrs [{inherit name; value = op n.${name} (a.${name} or nul); }]) ) a (attrNames n) ) {} list_of_attrs; diff --git a/lib/default.nix b/lib/default.nix index 4b6027c437be..cd0d8161c8cb 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -11,7 +11,7 @@ let types = import ./types.nix; meta = import ./meta.nix; debug = import ./debug.nix; - misc = import ./misc.nix; + misc = import ./deprecated.nix; maintainers = import ./maintainers.nix; platforms = import ./platforms.nix; systems = import ./systems.nix; diff --git a/lib/misc.nix b/lib/deprecated.nix similarity index 99% rename from lib/misc.nix rename to lib/deprecated.nix index fd20ce25010c..54c253f2c34b 100644 --- a/lib/misc.nix +++ b/lib/deprecated.nix @@ -203,8 +203,6 @@ rec { in work startSet [] []; - genericClosure = builtins.genericClosure or lazyGenericClosure; - innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else innerModifySumArgs f x (a // b); modifySumArgs = f: x: innerModifySumArgs f x {}; diff --git a/lib/options.nix b/lib/options.nix index 6e8e9ce00061..5c543f56bcf3 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -4,7 +4,6 @@ let lib = import ./default.nix; in with import ./trivial.nix; with import ./lists.nix; -with import ./misc.nix; with import ./attrsets.nix; with import ./strings.nix; diff --git a/lib/strings.nix b/lib/strings.nix index f0ecb15ab2d3..895b230744f9 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -210,6 +210,7 @@ rec { # standard GNU Autoconf scripts. enableFeature = enable: feat: "--${if enable then "enable" else "disable"}-${feat}"; + # Create a fixed width string with additional prefix to match required width fixedWidthString = width: filler: str: let @@ -219,6 +220,7 @@ rec { assert strw <= width; if strw == width then str else filler + fixedWidthString reqWidth filler str; + # Format a number adding leading zeroes up to fixed width fixedWidthNumber = width: n: fixedWidthString width "0" (toString n); } diff --git a/lib/trivial.nix b/lib/trivial.nix index 8addde1b86cd..9fd5a7e1c57c 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -22,7 +22,7 @@ rec { inherit (builtins) pathExists readFile isBool isFunction isInt add sub lessThan - seq deepSeq; + seq deepSeq genericClosure; # Return the Nixpkgs version number. nixpkgsVersion =