lib.toC: admit derivations
This commit is contained in:
parent
9a7b7dc509
commit
c1a9a89c9a
@ -26,11 +26,15 @@ let out = rec {
|
|||||||
shell = import ./shell.nix { inherit lib; };
|
shell = import ./shell.nix { inherit lib; };
|
||||||
tree = import ./tree.nix { inherit lib; };
|
tree = import ./tree.nix { inherit lib; };
|
||||||
|
|
||||||
toC = x: {
|
toC = x: let
|
||||||
|
type = typeOf x;
|
||||||
|
reject = throw "cannot convert ${type}";
|
||||||
|
in {
|
||||||
list = "{ ${concatStringsSep ", " (map toC x)} }";
|
list = "{ ${concatStringsSep ", " (map toC x)} }";
|
||||||
null = "NULL";
|
null = "NULL";
|
||||||
|
set = if isDerivation x then toJSON x else reject;
|
||||||
string = toJSON x; # close enough
|
string = toJSON x; # close enough
|
||||||
}.${typeOf x};
|
}.${type} or reject;
|
||||||
|
|
||||||
subdirsOf = path:
|
subdirsOf = path:
|
||||||
mapAttrs (name: _: path + "/${name}")
|
mapAttrs (name: _: path + "/${name}")
|
||||||
|
Loading…
Reference in New Issue
Block a user