Nix 101 Course / Section 3: Dev shells: the productivity unlock
Premium

3.2 Your first dev shell with nix-shell

Lesson 19 of 68 · 6:43

placeholder thumbnail

Create a free account to watch this lesson

Free account · no credit card needed

About this lesson

One file with a handful of lines, and your project carries its complete toolchain with it. No Docker image, no system-wide installs, no setup chapter in the README. We build a real dev shell for a real C project (tmux) on a machine that has no compiler installed at all.

In this video

  • Your first shell.nix, and why it beats the endless nix-shell -p command your colleagues would have to memorize
  • Swapping a single tool and rebuilding: Nix downloads one package where Docker would rebuild a whole layer stack
  • Nesting shells: pull in an extra tool for a minute, exit, and it's gone. Try that with containers.
  • The workflow that makes "clone, nix-shell, build" the entire onboarding for every new team member

Free user context

If you have only seen the free videos from this course so far, let's add some context from the other videos:

  • The project that we have checked out here is the popular tmux tool, a shell multiplexer. We create a developer shell for it.
  • This example does not use flakes, as we learn about those later in section 9.
  • Flakes are just a different framing around the pkgs.mkShell call which stays the same. 😊

After this lesson

You can give any project a reproducible development environment that your whole team gets by running one command.