diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/lib/types.nix')
-rw-r--r-- | infra/libkookie/nixpkgs/lib/types.nix | 67 |
1 files changed, 60 insertions, 7 deletions
diff --git a/infra/libkookie/nixpkgs/lib/types.nix b/infra/libkookie/nixpkgs/lib/types.nix index e9e45dc25c72..ee891f8231b6 100644 --- a/infra/libkookie/nixpkgs/lib/types.nix +++ b/infra/libkookie/nixpkgs/lib/types.nix @@ -1,12 +1,65 @@ # Definitions related to run-time type checking. Used in particular # to type-check NixOS configurations. { lib }: -with lib.lists; -with lib.attrsets; -with lib.options; -with lib.trivial; -with lib.strings; + let + inherit (lib) + elem + flip + functionArgs + isAttrs + isBool + isDerivation + isFloat + isFunction + isInt + isList + isString + isStorePath + setFunctionArgs + toDerivation + toList + ; + inherit (lib.lists) + all + concatLists + count + elemAt + filter + foldl' + head + imap1 + last + length + tail + unique + ; + inherit (lib.attrsets) + attrNames + filterAttrs + hasAttr + mapAttrs + optionalAttrs + zipAttrsWith + ; + inherit (lib.options) + getFiles + getValues + mergeDefaultOption + mergeEqualOption + mergeOneOption + showFiles + showOption + ; + inherit (lib.strings) + concatMapStringsSep + concatStringsSep + escapeNixString + isCoercibleToString + ; + inherit (lib.trivial) + boolToString + ; inherit (lib.modules) mergeDefinitions; outer_types = @@ -270,7 +323,7 @@ rec { name = "attrs"; description = "attribute set"; check = isAttrs; - merge = loc: foldl' (res: def: mergeAttrs res def.value) {}; + merge = loc: foldl' (res: def: res // def.value) {}; emptyValue = { value = {}; }; }; @@ -499,7 +552,7 @@ rec { show = v: if builtins.isString v then ''"${v}"'' else if builtins.isInt v then builtins.toString v - else if builtins.isBool v then if v then "true" else "false" + else if builtins.isBool v then boolToString v else ''<${builtins.typeOf v}>''; in mkOptionType rec { |