[Nix-dev] Rust prebuilt package overlay.

Nicolas Pierron nicolas.b.pierron at nbp.name
Wed Mar 8 01:58:50 CET 2017


On Tue, Mar 7, 2017 at 1:41 PM, Profpatsch <mail at profpatsch.de> wrote:
> On 17-03-04 08:34pm, Nicolas Pierron wrote:
>> The *.toml manifest file is then parsed (yes, in Nix [3]) to extract
>> [3] https://github.com/mozilla/nixpkgs-mozilla/blob/master/lib/parseTOML.nix
>
> what have you done

I made tool to avoid updating this repository every time there is a
new nightly version of rustc.
This Nix expression is able to parse a 200 kB toml file in less than 1 second.

To make it short:
 - The tokenizer abuse ` builtin.match ` ability to generate a list of
strings out of the captured regex, and avoid deep recursions by
approximating down the number of expected tokens.
 - The parser uses ` builtin.foldl' `, to make some kind of for-loop
which does not consume space and mutate the parser state to
reconstruct the corresponding attribtue set of the *.toml file

If you want more detail, maybe I should present it at the next NixCon.

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/


More information about the nix-dev mailing list