mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
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
This commit is contained in:
parent
1cb9fc74b7
commit
6d4fa01f1e
48
pkgs/lib/strings-with-deps.nix
Normal file
48
pkgs/lib/strings-with-deps.nix
Normal file
@ -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;};
|
||||
}
|
Loading…
Reference in New Issue
Block a user