| 14 Oct 2025 |
emily | so I thought it was worth raising again because it seemed to have been bikeshedded into a radix conversion function that wouldn't work to implement the built-in and stalled out | 16:17:07 |
K900 | Man this is so cursed | 16:17:36 |
emily | I guess there is no other way to produce an SRI or Base32 hash of a string in Nix currently, e.g. | 16:17:40 |
K900 | Literally none of those uses of convertHash are valid | 16:17:45 |
emily | or if you want to convert an SRI hash into a Base16 one for generating a specific lock file format or something | 16:18:19 |
raitobezarius | I mean I get it if you store your lockfile in a certain format and you want to feed it to Nix FODs | 16:18:27 |
emily | especially if sha256 etc. are deprecated in favour of hash for fetchers | 16:18:37 |
K900 | You can just do sha256:<foo> | 16:18:38 |
raitobezarius | But making this a primitive in builtins is… well… :) | 16:18:41 |
emily | which people have wanted to do for a while | 16:18:43 |
K900 | Which is a valid outputHash | 16:18:48 |
K900 | As in it works everywhere SRI works | 16:18:53 |
emily | I think there is a desire to standardize on SRI exclusively in Nixpkgs | 16:19:03 |
K900 | I think this is a non-issue _for generated code- | 16:19:16 |
K900 | I think this is a non-issue for generated code | 16:19:18 |
K900 | Or generated drvs | 16:19:21 |
raitobezarius | From what I see, it's doubly problematic that people have already started doing builtins.convertHash instead of lib.convertHash | 16:19:35 |
emily | https://github.com/NixOS/nixpkgs/commit/1cf3103bcaf3b45aed2e8e0801f96207d2e98745 seems like a legitimate use case since it is required to match the filename format for passAsFile? | 16:20:24 |
emily | though admittedly I don't know if there are stability guarantees on that format | 16:20:31 |
raitobezarius | Of an absolutely undocumented thing | 16:20:34 |
raitobezarius | Now, we made public and visible the mechanism for .attr- filenames | 16:20:48 |
emily | right. but it still does not seem that weird to want to compute it | 16:20:59 |
raitobezarius | Yeah, but we are mixing up multiple concerns | 16:21:24 |
raitobezarius | There's the overall desire of doing what the OP of that change is doing | 16:21:32 |
raitobezarius | And what convertHash should be and how should it serve | 16:21:39 |
emily | the brew-nix use was admittedly pretty trivial https://github.com/BatteredBunny/brew-nix/commit/88a94a007fc212a04784a3dc0aab6692f405251a | 16:21:44 |
emily | but I am not sure if hash = "sha256:" + …; is going to be considered desirable long-term once sha256 = …; is deprecated in fetchers | 16:21:58 |
raitobezarius | To get progress on convertHash, I can free some time to do:
- {from,to}{NixBase32,Base64,Base16} and see what a
convertHash based on that looks like
| 16:21:59 |
raitobezarius | It's going to be crucial that convertHash exist in nixpkgs | 16:22:10 |
emily | given it is another quirky non-standard format vs. SRI | 16:22:11 |