stockholm/krebs/4lib/default.nix

32 lines
661 B
Nix
Raw Normal View History

2015-07-24 12:23:52 +02:00
{ lib, ... }:
2015-07-24 20:48:00 +02:00
with builtins;
with lib;
2015-10-17 17:03:43 +02:00
rec {
2015-07-24 20:48:00 +02:00
2015-10-15 00:55:07 +02:00
eq = x: y: x == y;
2015-07-24 20:48:00 +02:00
addName = name: set:
set // { inherit name; };
addNames = mapAttrs addName;
2015-07-24 12:23:52 +02:00
types = import ./types.nix { inherit lib; };
dns = import ./dns.nix { inherit lib; };
listset = import ./listset.nix { inherit lib; };
shell = import ./shell.nix { inherit lib; };
tree = import ./tree.nix { inherit lib; };
2015-08-28 21:31:59 +02:00
toC = x: {
list = "{ ${concatStringsSep ", " (map toC x)} }";
null = "NULL";
string = toJSON x; # close enough
}.${typeOf x};
2015-10-15 00:59:00 +02:00
subdirsOf = path:
mapAttrs (name: _: path + "/${name}")
(filterAttrs (_: eq "directory") (readDir path));
2015-07-24 12:23:52 +02:00
}