3.3 Deriving the dev shell from the package definition
Lesson 20 of 68 · 6:22
Up next in 5s…
About this lesson
Listing 15 packages in a shell.nix works, but it leaves you with two descriptions of your project: what developers use, and what CI and production actually build. This lesson flips the order. You describe the package build once, and Nix hands you the matching dev shell for free, so nix-shell and nix-build are guaranteed to agree.
In this video
- Why "works in my shell, fails in CI" happens, and how the build sandbox removes the guesswork
- Turning the
tmuxshell definition into a real package withstdenv.mkDerivation: the handful of attributes it needs - What
mkDerivationfigures out on its own about aconfigureandmakebased project, and the one step it cannot detect - The fallback trick that makes
nix-shellwork with noshell.nixin the repo at all - Running the exact same
nix-buildyour CI runs, before you commit anything
After this lesson
You can build a small autotools project as a Nix package and drop into its dev shell from the same file, with one single source of truth for developers, CI, and production.