mirror of https://cgit.krebsco.de/nix-writers
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
775 B
24 lines
775 B
let {
|
|
body = lib;
|
|
|
|
lib = nixpkgs.lib // builtins // (with lib; {
|
|
genAttrs' = names: f: listToAttrs (map f names);
|
|
getAttrs = names: set:
|
|
listToAttrs (map (name: nameValuePair name set.${name})
|
|
(filter (flip hasAttr set) names));
|
|
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;
|
|
test = re: x: isString x && testString re x;
|
|
testString = re: x: match re x != null;
|
|
types = nixpkgs.lib.types // import ./types.nix { lib = body; };
|
|
});
|
|
|
|
nixpkgs.lib = import <nixpkgs/lib>;
|
|
}
|
|
|