|
||
---|---|---|
.gitignore | ||
LICENSE.md | ||
README.md | ||
default.nix | ||
flake.lock | ||
flake.nix | ||
nix-introduction.ipynb |
README.md
nix flakes BinderHub example
Why Nix?
Nix would be a great addition to reproducible data science. It is a unique package manager. Some notable features:
- 100% reproducible environments (pin to exact commit in repository)
- both a source and binary package repository
- allows customized compilation and version of every package
- can run identical environment outside of docker (all linux distros + dawin)
- as of now 45,000+ packages
- fully declarative environments
- packages: python, javascript, julia, R, haskell, perl, and many other languages (some better than others).
Assuming that you have nix
installed (compatible with all
linux distributions and darwin (Mac OS)) you can run this repository
locally (no need for binderhub). It will be identical assuming you
have pinned repositories. Nix can coexist fine with other package
managers.
This derivation installs python38
, numpy
, and scipy
.
For a more detailed example see the detailed binderhub example costrouc/nix-binder-example
Why nix flakes?
"Flakes" is an upcoming feature of the nix package manager that allows
you to declaratively specify the dependencies for a nix environment
and automatically handle pinning those dependencies with a
flake.lock
file in the repository, as well as declaratively
specifying the configuration of packages described above. The
environment and its dependencies are defined in flake.nix
.
With flakes enabled in your nix installation, you can start a shell with an identical environment with the following command, without needing to clone the repository yourself:
nix develop 'git+https://tildegit.org/petrichor/binder-nix-flakes.git?ref=main'
This example uses the
flake-compat library to
take advantage of the flakes feature in default.nix
without needing
a version of nix
with flakes support. The lock file can be updated
using the unstable branch of nix by running nix flake update
. This
means that the existing nix buildpack in repo2docker will use the
flake transparently.