Nix - Define your development environment

How many package managers do you use per day?

npm, pip, bundler, cabal, stack, composer, cargo, cpan, goget, maven, nuget, opam, ...

apt-get, rpm, brew, emerge, ...

docker, vmware, virtualbox, vagrant, lxc, rkt, xen, ...

ansible, chef, puppet, fabric, ...

Nix

a build tool

also a package manager

works on any POSIX system

alongside your existing package manager

doesn't break your existing system

also extends to whole linux distribution - NixOS

Atomic

Works on my machine

Rollbacks

Multiple envs

Source / Binary

github.com/mozilla-releng/services

$ which elm-make
elm-make not found

# https://mozilla-releng.net
$ nix-shell nix/default.nix -A releng_frontend

(nix-shell) $ which elm-make
/nix/store/...-elm-0.17.1/bin/elm-make

(nix-shell) $ exit
$ which python
python not found

$ nix-shell nix/default.nix -A releng_treestatus

(nix-shell) $ which python
/nix/store/....-python-3.5.2/bin/python

(nix-shell) $ exit

$ nix-build nix/docker.nix -A releng_treestatus -o ./result
$ realpath ./result
/nix/store/...-docker-image-releng_treestatus.tar.gz

$ cat result | docker load
$ docker images
REPOSITORY              TAG                 IMAGE ID     ...
releng_treestatus       2                   6a789c605a69 ...

github.com/garbas/nixpkgs

$ nix-build -A VidyoDesktop -o ./result
$ ./result/bin/VidyoDesktop
$ nix-shell -A gecko
(nix-shell) $ cd path/to/gecko/clone
(nix-shell) $ ./mach build

$ nix-build release.nix -A gecko.x86_64-linux.clang \
                                           -o firefox-x64
$ ./firefox-x64/bin/firefox

$ nix-build release.nix -A gecko.i686-linux.gcc48 \
                                           -o firefox-x86
$ ./firefox-x86/bin/firefox

Thank you

@garbas