!VRULIdgoKmKPzJZzjj:nixos.org

Nix Hackers

884 Members
For people hacking on the Nix package manager itself186 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
5 Mar 2025
@Ericson2314:matrix.orgJohn Ericson Based on this, I feel like both types of placeholders could look exactly like store paths, except for using a different hash character set to very subtly distinguish them 16:08:25
@Ericson2314:matrix.orgJohn Ericson I might be a little worried about that confusing humans, hah, who just glance at it 16:08:55
@Ericson2314:matrix.orgJohn EricsonBut it would be great for code in Nixpkgs that wants to look for name parts and and the store dir16:09:29
@roberthensing:matrix.orgRobert Hensing (roberth) Canonical JSON looks kinda good. Canonical, sorted, no floats. Strings are bytes, so not technically JSON. RFC 8785 is complicated and does not allow non-Unicode bytes 16:31:41
@emilazy:matrix.orgemily please don't use canonicalized JSON formats 16:42:10
@emilazy:matrix.orgemilypeople WILL use something less rigid and only find out years down the line when it's a huge headache16:42:25
@emilazy:matrix.orgemilypick a format that's rigid by design or at least has a canonical format rigidly specified in the same spec rather than being something people have made 100 canonical versions of16:42:54
@emilazy:matrix.orgemilyit's a huge footgun, everyone who uses JSON in a cryptographic context gets bitten by this eventually. Matrix included iirc :)16:43:17
@roberthensing:matrix.orgRobert Hensing (roberth)hmm ok. Something human readable would be great (and something not ATerm)16:45:17
@emilazy:matrix.orgemily

human-readable can actually be a drawback for formats specifically designed to be non-malleable, precisely because they invite opening in a text editor and appending some keys in whatever order.

fwiw, https://preserves.dev/ is well-designed, has a superset of JSON types, and has both a textual format and a binary format with a rigidly-defined canonical representation for the latter. however it's also a bit obscure and won't have as wide library support as alternatives so I can understand not going with it. the Spritely/Agoric/Cap'n Proto standardization effort OCapN uses it as Syrup, which is a separate canonical-but-made-up-of-printable-characters serialization of it https://github.com/ocapn/syrup#pseudo-specification.

more well-known alternatives:

  • deterministic CBOR serialization, buuuut there are like three versions of it so caveat emptor https://www.imperialviolet.org/2022/04/17/canonsofcbor.html
  • canonical s-expressions
  • bencode
  • …ASN.1 BER? 🙃

also, if you don't actually need a flexible/extensible format, defining your own very simple rigid serialization isn't a sin when you want cryptographic canonicity. (just make sure it's actually non-ambiguous and preferably can't be corrupted into another valid message by truncation, especially if you might be concatenating multiple messages.)

17:00:57

Show newer messages


Back to Room ListRoom Version: 6