diff options
author | makefu <github@syntax-fehler.de> | 2016-02-15 17:07:48 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2016-02-15 17:07:48 +0100 |
commit | 3ceff0ec29a36119ea83f02c8943752d91b250e9 (patch) | |
tree | 7b179bc972ea01c9305ea64697e14237346885d8 /krebs/4lib/default.nix | |
parent | 9a4071b66ff45e99a30e9a314eb43c6efc7e921f (diff) | |
parent | 372f2d77f301719e396a6f943657325e2f8b2cf4 (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}") |