Fireship · @fireship
Nix in 100 Seconds
Uploaded August 21, 2024 · Length 3:33
Summary
Nix package manager explained in 100 seconds: reproducible, declarative, and transactional system configuration.
- nix package manager
- nixos
- declarative configuration
- reproducible builds
- linux distro
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
NYX a purely functional package manager
- 0:02
and system configuration tool that
- 0:04
allows developers to say it works on my
- 0:06
machine with absolute confidence it was
- 0:09
created in 2003 by eel cdra who wrote
- 0:12
his PhD thesis on a purely functional
- 0:14
software deployment model 20 years later
- 0:16
it's used by tons of software projects
- 0:18
like Mozilla Firefox Google's idx and of
- 0:21
course NYX OS a complete Linux distro
- 0:24
based on this package manager but why
- 0:26
NYX when you set up your own Linux
- 0:28
server the default approach is to sh
- 0:30
into it and start running a bunch of
- 0:31
commands that you copied from random
- 0:33
places on the internet the problem is
- 0:35
that it quickly becomes impossible to
- 0:36
reproduce the state of your machine and
- 0:38
if you mess something up there's no undo
- 0:40
button NYX users don't have these
- 0:42
problems because it provides its own
- 0:43
declarative language to Define packages
- 0:46
network settings the file system
- 0:48
environment variables users and
- 0:50
everything else you need in a NX file
- 0:52
this file is like a blueprint that can
- 0:53
now reproduce the same machine over and
- 0:55
over again now any changes to this
- 0:57
config are transactional or atomic
- 0:59
meaning everything succeeds or fails
- 1:02
together a huge advantage of that is
- 1:03
when you screw something up you can
- 1:05
easily roll back to the previous state
- 1:07
it's like having a time machine for your
- 1:08
machine this is possible because in the
- 1:10
nyck store each package and its
- 1:12
dependencies are stored in a separate
- 1:14
directory identified by a unique
- 1:16
cryptographic hash which guarantees that
- 1:18
packages won't interfere with each other
- 1:20
and with Nick shell you can create
- 1:21
unique environments for all of your
- 1:23
projects that means side by-side
- 1:25
installation for all of your tools in
- 1:27
their different versions without the
- 1:28
need for version managers like NVM
- 1:30
virtual EnV or rust up because it's all
- 1:33
declarative and deterministic you can
- 1:34
organize your configs as Flakes and then
- 1:36
trade them with your friends like their
- 1:38
Pokémon cards to get started install the
- 1:40
Nyx package manager or better yet live
- 1:42
boot NYX OS to try it out as a full
- 1:44
Linux drro inside the ETC directory
- 1:47
you'll find a configuration.nix file you
- 1:49
can think of this file as a function
- 1:51
that returns a dictionary or hashmap at
- 1:53
the top we have parameters for config
- 1:55
which gives us access to the entire
- 1:57
configuration and packages which
- 1:59
includes all theack packages available


