Loading pkgs/pkgs-lib/formats.nix +32 −31 Original line number Diff line number Diff line Loading @@ -58,6 +58,38 @@ let submodule ; /* Creates a structured value type suitable for serialization formats. Parameters: - typeName: String describing the format (e.g. "JSON", "YAML", "XML") - nullable: Whether the structured value type allows `null` values. Returns a type suitable for structured data formats that supports: - Basic types: boolean, integer, float, string, path - Complex types: attribute sets and lists */ mkStructuredType = { typeName, nullable ? true, }: let baseType = oneOf [ bool int float str path (attrsOf valueType) (listOf valueType) ]; valueType = (if nullable then nullOr baseType else baseType) // { description = "${typeName} value"; }; in valueType; # Attributes added accidentally in https://github.com/NixOS/nixpkgs/pull/335232 (2024-08-18) # Deprecated in https://github.com/NixOS/nixpkgs/pull/415666 (2025-06) allowAliases = pkgs.config.allowAliases or false; Loading Loading @@ -126,37 +158,6 @@ optionalAttrs allowAliases aliases php = (import ./formats/php/default.nix { inherit lib pkgs; }).format; /* Creates a structured value type suitable for serialization formats. Parameters: - typeName: String describing the format (e.g. "JSON", "YAML", "XML") Returns a type suitable for structured data formats that supports: - Basic types: boolean, integer, float, string, path - Complex types: attribute sets and lists */ mkStructuredType = { typeName, nullable ? true, }: let baseType = oneOf [ bool int float str path (attrsOf valueType) (listOf valueType) ]; valueType = (if nullable then nullOr baseType else baseType) // { description = "${typeName} value"; }; in valueType; json = { }: { Loading Loading
pkgs/pkgs-lib/formats.nix +32 −31 Original line number Diff line number Diff line Loading @@ -58,6 +58,38 @@ let submodule ; /* Creates a structured value type suitable for serialization formats. Parameters: - typeName: String describing the format (e.g. "JSON", "YAML", "XML") - nullable: Whether the structured value type allows `null` values. Returns a type suitable for structured data formats that supports: - Basic types: boolean, integer, float, string, path - Complex types: attribute sets and lists */ mkStructuredType = { typeName, nullable ? true, }: let baseType = oneOf [ bool int float str path (attrsOf valueType) (listOf valueType) ]; valueType = (if nullable then nullOr baseType else baseType) // { description = "${typeName} value"; }; in valueType; # Attributes added accidentally in https://github.com/NixOS/nixpkgs/pull/335232 (2024-08-18) # Deprecated in https://github.com/NixOS/nixpkgs/pull/415666 (2025-06) allowAliases = pkgs.config.allowAliases or false; Loading Loading @@ -126,37 +158,6 @@ optionalAttrs allowAliases aliases php = (import ./formats/php/default.nix { inherit lib pkgs; }).format; /* Creates a structured value type suitable for serialization formats. Parameters: - typeName: String describing the format (e.g. "JSON", "YAML", "XML") Returns a type suitable for structured data formats that supports: - Basic types: boolean, integer, float, string, path - Complex types: attribute sets and lists */ mkStructuredType = { typeName, nullable ? true, }: let baseType = oneOf [ bool int float str path (attrsOf valueType) (listOf valueType) ]; valueType = (if nullable then nullOr baseType else baseType) // { description = "${typeName} value"; }; in valueType; json = { }: { Loading