Nix Istanbul session

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).

6 Likes

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:

  1. Show some examples of Nix syntax (without any derivations)
  2. Show using simple Nix expressions in practice using nix-instantiate --strict --json --eval
  3. Introduce mkShell and how it can create a controlled shell environment
  4. Show mkShell in practice using nix-shell
  5. Introduce mkDerivation on a practical example package simpler than status-react
  6. Show its usage with nix-build and what are its results
  7. Introduce /nix/store and its structure
  8. 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.

5 Likes

looking forward to this. Been playing with nixOS on an old laptop so this will be quite helpful.

1 Like

I’m starting to work on the presentation slides here. In case you have suggestions feel free to add comments.

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.

1 Like

Agree. I’m already working on a simple repo where each commit shows off a syntax element of the Nix language.

Demo repo link: GitHub - pedropombeiro/nix-demo: Walkthrough of basic Nix language features for Istanbul presentation

1 Like