builtins.randomStorePath video − Implementing a new Nix builtin

Hey everyone :wave:t2:

I’m starting a series of videos in which we’ll dive into the internals of the Nix codebase by implementing together a new builtin function builtins.randomStorePath − which as its name indicates will return us a new random store path from the underlying store everytime it is called.

The idea is that thanks to this utterly useless but quite transversal feature, we’ll have the opportunity to discover as much as possible of how things work behind the scenes (the secret end-goal being to turn you into a successful Nix contributor).

I’ve just uploaded a first video (with @fricklerhandwerk) in which we implement a somewhat working but very naive version of it:

There’s a few others planned, covering different topics like the Store api, the implementation of the “local” and “daemon” stores (maybe also the binary caches, though that won’t fit as naturally), the build loop, the (new) cli, and going further with the new, weird and exciting stuff like content-addressed and impure derivations.
And of course, feel free to let me know if there’s any particular topic that you’d like to see covered, we can always torture the original topic to make it fit :wink:.

Hope you’ll enjoy it and find it useful!

9 Likes

I’ve just uploaded a second episode (recorded with @Infinisil) where we special-case the local store scenario (single-user, no daemon) to directly get the random path from the db without having to list everything, which makes the builtins much faster.

4 Likes

It’s been a while, but I eventually found the time to publish a third one (with @mrkkrp) where we mess with the daemon protocol to make this work (efficiently) over the network

And now a fourth one (thanks to @googleson78) dealing with the CLI interface and the logging system: