stockholm/krebs/4lib/default.nix

39 lines
893 B
Nix
Raw Normal View History

2015-07-24 10:23:52 +00:00
{ lib, ... }:
2015-07-24 18:48:00 +00:00
with builtins;
with lib;
2015-11-09 18:07:26 +00:00
let out = rec {
2015-07-24 18:48:00 +00:00
2015-10-14 22:55:07 +00:00
eq = x: y: x == y;
2015-07-24 18:48:00 +00:00
addName = name: set:
set // { inherit name; };
addNames = mapAttrs addName;
2015-07-24 10:23:52 +00:00
types = import ./types.nix { inherit lib; };
dir.has-default-nix = path: pathExists (path + "/default.nix");
dns = import ./dns.nix { inherit lib; };
2015-11-09 18:07:26 +00:00
git = import ./git.nix { lib = lib // out; };
listset = import ./listset.nix { inherit lib; };
shell = import ./shell.nix { inherit lib; };
tree = import ./tree.nix { inherit lib; };
2015-08-28 19:31:59 +00:00
toC = x: {
list = "{ ${concatStringsSep ", " (map toC x)} }";
null = "NULL";
string = toJSON x; # close enough
}.${typeOf x};
2015-10-14 22:59:00 +00:00
subdirsOf = path:
mapAttrs (name: _: path + "/${name}")
(filterAttrs (_: eq "directory") (readDir path));
mapAttrValues = f: mapAttrs (_: f);
setAttr = name: value: set: set // { ${name} = value; };
2015-11-09 18:07:26 +00:00
}; in out