During the Istanbul offsite, I’ll be doing a presentation about Nix and how we use it in the status-react repo. I would like to get your suggestions on format/content. Here’s an initial draft to seed the discussion:
Quick explainer of the Nix language;
Building a simple development environment with Nix;
Walkthrough of some areas of our status-react Nix setup;
Q&A.
The initial time slot allocated for the session is 30 minutes, but I imagine we can change that default to 1 hour depending on the interest and number of questions you’ll be bringing (highly recommended as we don’t have that many face-to-face opportunities to transmit knowledge about complex subjects).
This is a great idea, and I’m looking forward to seeing your presentation.
I think it’s more important to explain how Nix works and how to use it, rather than the intricate details of its setup in status-react repo, which is very complex.
In my opinion it would make most sense to:
Show some examples of Nix syntax (without any derivations)
Show using simple Nix expressions in practice using nix-instantiate --strict --json --eval
Introduce mkShell and how it can create a controlled shell environment
Show mkShell in practice using nix-shell
Introduce mkDerivation on a practical example package simpler than status-react
Show its usage with nix-build and what are its results
Introduce /nix/store and its structure
Go more in-depth by showing usage of nix-instantiate with nix-build
Not sure if this can be fit in 1 hour, but that’s how I’d like to see it done if I was to forget all I know about Nix and had to re-learn it. Only after having this foundation would showing examples from status-react be useful to someone previously unfamiliar with Nix.
I’m worried that starting with nix-instantiate could prove to be a source of confusion for people just getting into Nix. Maybe this should be left to a later point in the session?
On second thought, if we use it purely to demonstrate the different aspects of the Nix language syntax and make it clear that nix-instantiate is not a command you’d commonly need to use, it might be OK and a great way to quickly go through the Nix language basics.
That doesn’t sound very confusing if you make it clear that it’s a plumbing command rather than one used to get the final result, like nix-build. And I do think it’s useful for showing how the syntax works and testing small sections of Nix code.
Up to you really, but the issue with nix-build is that there is no print command in Nix as far as I know, you so you can’t really inspect what your expression is doing without building something over and over and over again, which isn’t a good feedback loop for a developer.