diff options
author | makefu <github@syntax-fehler.de> | 2016-10-24 14:14:58 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2016-10-24 14:14:58 +0200 |
commit | 36cbb3d300eb18330a62ba20e35f80d515f5bc5f (patch) | |
tree | dedf23acdc5763b59b5853b07dd297b88fb15636 /krebs/4lib/default.nix | |
parent | 3fa63a4f312a885d353177db911f8a52ce7a1e1c (diff) | |
parent | 08c7671fc51270e582e16cbe49aa896f8bff7685 (diff) |
Merge remote-tracking branch 'cd/master'
Diffstat (limited to 'krebs/4lib/default.nix')
-rw-r--r-- | krebs/4lib/default.nix | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix deleted file mode 100644 index c40b9a868..000000000 --- a/krebs/4lib/default.nix +++ /dev/null @@ -1,59 +0,0 @@ -_: - -let - lib = import <stockholm/lib>; -in - -with lib; - -let out = lib // rec { - - guard = spec@{ type, value, ... }: - assert isOptionType type; - if type.check value - then value - else throw (toString (filter isString [ - "argument" - (if spec ? name then "‘${spec.name}’" else null) - "is not a ${type.name}" - ])); - - types = import ./types.nix { - lib = lib // { inherit genid optionalTrace; }; - }; - - genid = import ./genid.nix { lib = lib // out; }; - genid_signed = x: ((genid x) + 16777216) / 2; - git = import ./git.nix { lib = lib // out; }; - tree = import ./tree.nix { inherit lib; }; - - lpad = n: c: s: - if stringLength s < n - then lpad n c (c + s) - else s; - - 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 - }.${type} or reject; - - subdirsOf = path: - mapAttrs (name: _: path + "/${name}") - (filterAttrs (_: eq "directory") (readDir path)); - - genAttrs' = names: f: listToAttrs (map f names); - - getAttrs = names: set: - listToAttrs (map (name: nameValuePair name set.${name}) - (filter (flip hasAttr set) names)); - - setAttr = name: value: set: set // { ${name} = value; }; - - optionalTrace = c: msg: x: if c then trace msg x else x; - -}; in out |