!lymvtcwDJ7ZA9Npq:lix.systems

Lix Development

396 Members
(Technical) development of Lix, the package manager, a Nix implementation. Please be mindful of ongoing technical conversations in this channel.134 Servers

Load older messages


SenderMessageTime
14 Oct 2025
@raitobezarius:matrix.orgraitobezarius I'm really unhappy about convertHash as a primitive, it also does not enable any form of detection of what pairs does it support and what it can do 16:10:34
@emilazy:matrix.orgemily this may be more "pure" but it also feels a bit error-prone compared to just having convertHash handle it 16:10:43
@emilazy:matrix.orgemilybut it at least only needs solving once16:10:52
@emilazy:matrix.orgemily(unless the quirks change later)16:10:55
@raitobezarius:matrix.orgraitobezariusYeah, but that direction is easy because the implementations accepts more than they should16:10:57
@raitobezarius:matrix.orgraitobezariuswhich would be a regression caught by tests hopefully16:11:30
@emilazy:matrix.orgemilyI think you would need a size parameter16:11:35
@emilazy:matrix.orgemilywhich is not very nice16:11:39
@emilazy:matrix.orgemilybecause now Nixpkgs has a look-up table of hashes to byte sizes too… etc.16:11:49
@emilazy:matrix.orgemilynot the end of the world16:12:02
@raitobezarius:matrix.orgraitobezarius I'm pretty confident that we don't want convertHash in Lix, we might accept convertBinary but I'm not super comfy about getting this on a short timeline, I'm confident about {from,to}{NixBase32,Base16,Base64} primitives in builtins.conversions and we can look at an convertHash implementation beforehand with such built-ins on a short timeline 16:13:05
@raitobezarius:matrix.orgraitobezariusI don't know what is the timeline you are operating with to have this code available16:13:39
@raitobezarius:matrix.orgraitobezarius Seems like the passAsFile thing used there is exploiting an implementation detail about passAsFile internal details, which does not seem to be an excellent usecase for convertHash 16:14:51
@k900:0upti.meK900OK question (please tell me if I'm being stupid), what's the actual use case for this?16:16:27
@emilazy:matrix.orgemily I don't care about it on a personal level, I just know that it regularly comes up as a blocker for using Lix for people, e.g. brew-nix used it, https://github.com/search?q=convertHash+language%3Anix&type=code shows many examples, and as i linked in https://github.com/NixOS/nixpkgs/pull/451929 an attempt to do feature-detection in Nixpkgs caused hash divergence between Nix and Lix 16:16:35
@emilazy:matrix.orgemilyso 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 out16:17:07
@k900:0upti.meK900Man this is so cursed16:17:36
@emilazy:matrix.orgemilyI 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:0upti.meK900Literally none of those uses of convertHash are valid16:17:45
@emilazy:matrix.orgemilyor if you want to convert an SRI hash into a Base16 one for generating a specific lock file format or something16:18:19
@raitobezarius:matrix.orgraitobezariusI mean I get it if you store your lockfile in a certain format and you want to feed it to Nix FODs16:18:27
@emilazy:matrix.orgemily especially if sha256 etc. are deprecated in favour of hash for fetchers 16:18:37
@k900:0upti.meK900 You can just do sha256:<foo> 16:18:38
@raitobezarius:matrix.orgraitobezariusBut making this a primitive in builtins is… well… :)16:18:41
@emilazy:matrix.orgemilywhich people have wanted to do for a while16:18:43
@k900:0upti.meK900 Which is a valid outputHash 16:18:48
@k900:0upti.meK900As in it works everywhere SRI works16:18:53
@emilazy:matrix.orgemilyI think there is a desire to standardize on SRI exclusively in Nixpkgs16:19:03
@k900:0upti.meK900I think this is a non-issue _for generated code-16:19:16
@k900:0upti.meK900 I think this is a non-issue for generated code 16:19:18

Show newer messages


Back to Room ListRoom Version: 10