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

3.5 nix develop and flake-based dev shells

Lesson 22 of 68 · 13:25

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

About this lesson

You have a working package and dev shell without flakes. This lesson turns the same tmux project into a flake.nix, so you see exactly what flakes add, what they cost in boilerplate, and when each style is the better fit. You end up entering the shell with nix develop instead of nix-shell, from a definition anyone can build straight from a Git URL.

In this video

  • Generating a starting point with nix flake init and reading its inputs and outputs
  • The per-architecture problem: why a naive flake only builds on one platform, and a template that generates outputs for every system you support
  • Moving the tmux package and dev shell into flake outputs, checked with nix flake show
  • Small quality of life details: the default package, build logs with -L, and a shell hook for environment variables
  • An honest look at the tradeoffs, including flake-utils and flake-parts, and why some companies with huge monorepos went back to plain Nix expressions

After this lesson

You can flakify an existing project, support Linux and macOS on multiple architectures from one file, and decide with clear criteria whether a project should use flakes at all.