% Managing Projects with Nix % サニエ エリック % 2017年2月24日 - Tokyo NixOS Meetup
-
Get a copy of the presentation repo to play with the code:
$ git clone https://github.com/Tokyo-NixOS/presentations.git
- News
- Managing Projects with Nix
- Docker Nix Builder
- Nix Bundle
- OSC 2017 Tokyo Spring
- Haskell -> 8.0.2
- Python 3 as default?
- 17.03
- Overview
- Preparing a dev environment
- Building with Nix
- Build web projects
- Making tests
nix-shell
can be used create custom environments
-
Nix shell is a tool to enter in a nix build environment
-
Can be used to create ad-hoc environments with custom packages
$ nix-shell -p elixir
-
Clean shells can spawned by using the
--pure
flag
- A
shell.nix
can be used to provide an environment - Declares build dependencies
- Can provide other programs (editors, tools, ...)
2017/02/examples/binserver/shell.nix
- Derivation files are used for building projects
- See last month slides and examples for more details
2017/01/source.markdown
2017/02/examples/binserver/default.nix
2017/02/examples/binserver/derivation.nix
- Derivations build packages
- ... but cannot manage global state (host configuration, ports, hosts, ...)
- NixOS + Nix containers can manage global state in a deterministic way
- Containers require to use modules, so ...
- Modules are the foundation of NixOS
- They are a declarative and determistic wa to manage OS configuration
- Easy to write and manage
2017/02/examples/binserver/module.nix
- Nix tests are the way NixOS modules are tested
- Example
- Nix tests are:
- Logical definition of machine(s)
- Test script
- Nix tests are run in a clean virtual environment
2017/02/examples/binserver/test.nix
- Hydra