3.1 Why dev shells beat system-wide installs and Docker
Lesson 18 of 68 · 9:23
Video chapters
-
0:00 Dev shells and project dependencies
-
1:24 Legacy setup: system installs and Docker
-
4:12 Why Nix shells are better for development
-
7:59 TMUX example and next steps
Transcript
Dev shells and project dependencies
0:00 Let's talk about Dev Shells in this chapter. So in general, each and any project that's like a little bit more complex will have many dependencies. You need some tool chain stuff installed, some libraries, tooling for developers like language servers and static analysis or whatever you like. And sometimes it's relatively complex to set up. And then people like fight for a setup once and then keep it secret and not try to change anything because it works.
0:32 And then a big system update comes and you're like, oh, so there's another half a day of fixing the tool chain or whatever setup. And that is something in the past when you started using Nix. So let's have a quick look at what you're going to discuss really in this chapter. So let's kind of weigh around what are the advantages and disadvantages of like legacy approaches where we either install toolchains and stuff system wide or in Docker containers.
1:05 And then on the contrary, when we use Nix, how do we from an ad hoc shell where we just find out what dependencies we need, come down to a persistent shell definition that we can commit with our code so our colleagues can just run Nix shell or Nix develop and get going immediately without even knowing what dependencies we have.
The full transcript comes with the lesson.
About this lesson
Setting up a project toolchain is often half a day of hunting dependencies out of a README, and one system update later it is broken again. This lesson compares the classic answers (installing everything system-wide with sudo, or building a Docker image) with a Nix dev shell, using the real tmux source tree as the running example. It is the case for why a reproducible development environment defined with nix-shell or nix develop changes how teams onboard.
In this video
- Reading the
tmuxREADME the hard way: dependencies scattered across the file, different package names on every distro - Writing a Dockerfile for the toolchain, and where it starts to hurt: two separate worlds, editors that cannot see your dependencies, and full image rebuilds after tiny changes
- The list of problems shared by both legacy approaches, from
sudoeverywhere to binaries that only match one distribution - What a Nix dev shell does differently: one command for every colleague, tools that vanish when you exit, no container wall between your editor and your dependencies
- Why the same shell definition can serve Linux and macOS
After this lesson
You can explain, with concrete arguments, why your team should stop maintaining setup wikis and Docker dev images, and you know exactly what the rest of this chapter will replace them with.
Links: