diff options
author | lassulus <lass@aidsballs.de> | 2016-02-16 17:15:00 +0100 |
---|---|---|
committer | lassulus <lass@aidsballs.de> | 2016-02-16 17:15:00 +0100 |
commit | 0b0b0d65ee05583529df831985580e392713d29a (patch) | |
tree | 7eb6799a996924d8e895c54633a47ea3d7a92a4c /krebs/4lib/default.nix | |
parent | 3d30e9cc9014ec6189410944015d3cd7d5ca95a6 (diff) | |
parent | b7a92f63884af00eb0243ec9328be689a6c9b845 (diff) |
Merge remote-tracking branch 'cd/master'
Diffstat (limited to 'krebs/4lib/default.nix')
-rw-r--r-- | krebs/4lib/default.nix | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index 4d7e0b549..d5b6d03ac 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -26,11 +26,15 @@ let out = rec { shell = import ./shell.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)} }"; null = "NULL"; + set = if isDerivation x then toJSON x else reject; string = toJSON x; # close enough - }.${typeOf x}; + }.${type} or reject; subdirsOf = path: mapAttrs (name: _: path + "/${name}") |