diff options
author | Michael Raskin <7c6f434c@mail.ru> | 2007-08-26 21:59:31 +0000 |
---|---|---|
committer | Michael Raskin <7c6f434c@mail.ru> | 2007-08-26 21:59:31 +0000 |
commit | 6d4fa01f1e681be36f3122b2359b953a8e41ccc7 (patch) | |
tree | e6bf633d2ab2e7042515c2ba70c9727e9c115839 /pkgs | |
parent | 1cb9fc74b7d8a3ce7d4cafe977b9f261a9f1dd24 (diff) | |
download | nixpkgs-6d4fa01f1e681be36f3122b2359b953a8e41ccc7.tar nixpkgs-6d4fa01f1e681be36f3122b2359b953a8e41ccc7.tar.gz nixpkgs-6d4fa01f1e681be36f3122b2359b953a8e41ccc7.tar.bz2 nixpkgs-6d4fa01f1e681be36f3122b2359b953a8e41ccc7.tar.lz nixpkgs-6d4fa01f1e681be36f3122b2359b953a8e41ccc7.tar.xz nixpkgs-6d4fa01f1e681be36f3122b2359b953a8e41ccc7.tar.zst nixpkgs-6d4fa01f1e681be36f3122b2359b953a8e41ccc7.zip |
Added strings-with-deps, a set of functions that are intended to
build a minimal text which includes given strings and satisfies 'dependencies' of type A requires B to go before it. Just like global variable intialization must occur before using them. Supposed to be used for constructing builder.sh . svn path=/nixpkgs/trunk/; revision=9196
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/lib/strings-with-deps.nix | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pkgs/lib/strings-with-deps.nix b/pkgs/lib/strings-with-deps.nix new file mode 100644 index 00000000000..5f6cafaa67a --- /dev/null +++ b/pkgs/lib/strings-with-deps.nix @@ -0,0 +1,48 @@ +args: + with args; + with lib; + let + inherit (builtins) + head tail isList; +rec { + +/* + let shelllib = rec { + a= { + text = "aaaa"; + deps = [b c]; + }; + b = { + text = "b"; + }; + c = { + text = "c"; + deps = []; + }; + }; + in + + [textClosure [shelllib.a] + textclosure shelllib.a]; + + +*/ + + textClosureDupList = arg: + ( + if isList arg then + textClosureDupList {text = ""; deps = arg;} + else + (if (arg ? deps) then + map textClosureDupList arg.deps + else []) + ++ [arg] + ); + + textClosureList = arg: uniqList (textClosureDupList arg); + textClosure = arg: concatStringsSep " +" (textClosureList arg); + + noDepEntry = text : {inherit text;}; + FullDepEntry = text : deps: {inherit text args;}; +} |