Develop

berlinjs meetup Feb 2015

Test

Deploy

using

Nix

#nix #nixos #berlinjs

Rok Garbas, @garbas

berlinjs meetup Feb 2015

Is there a problem?

berlinjs meetup Feb 2015

Is JavaScript special?

berlinjs meetup Feb 2015

What is Nix?

TO INSTALL

  % curl https://nixos.org/nix/install | sh


TO UNINSTALL

  % rm -Rf /nix
  % rm -Rf ~/.nix*

berlinjs meetup Feb 2015

Nix protects me, against me

UPDATE CHANNELS (look at this as apt-get update)

  % nix-channel --update


INSTALL "tig" application

  % nix-env --list-generations
  1002   2015-01-23 04:29:40   
  1003   2015-01-23 04:44:51

  % nix-env -i tig

  % nix-env --list-generations
  1002   2015-01-23 04:29:40   
  1003   2015-01-23 04:44:51   
  1004   2015-01-23 04:50:11

UNDO / ROLLBACK

  % nix-env --rollback   <or  nix-env --switch-generation 1003>

  % nix-env --list-generations
  1002   2015-01-23 04:29:40   
  1003   2015-01-23 04:44:51   

berlinjs meetup Feb 2015

How can Nix do this?

HOOKS INTO BASH

  % echo $PATH
  /home/rok/.nix-profile/bin:/home/rok/.nix-profile/sbin:...

  % tree -L 2 `realpath ~/.nix-profile`
  /nix/store/xj8592ssnmcsn1kvbf87nm1acllwcqan-user-environment
  ├── bin
  │   ├── tig -> /nix/store/j3scw814k79mj3mm6x6yj9svvcq1plx4-tig-2.0.3/bin/tig
  │   ├── tree -> /nix/store/g75lq2kmfwx5sdqni6khv04kdklh3kq9-tree-1.7.0/bin/tree
  ├── etc
  │   ├── bash_completion.d -> /nix/store/j3scw814k79mj3mm6x6yj9svvcq1plx4-tig-2.0.3/etc/bash_completion.d
  │   └── tigrc -> /nix/store/j3scw814k79mj3mm6x6yj9svvcq1plx4-tig-2.0.3/etc/tigrc
  └── manifest.nix -> /nix/store/gjia0lic4v117fm3la3c4wkk6ig2iw3q-env-manifest.nix

/nix/store/j3scw814k79mj3mm6x6yj9svvcq1plx4-tig-2.0.3

/nix/store/

+

<hash>

+

<name>

+

<version>

berlinjs meetup Feb 2015

But what does this has to do with JavaScript?

TOOL THAT RESOLVES NPM DEPENDENCIES
    AND CREATES NIX EXPRESSIONS

  % nix-env -i npm2nix

  % cd to/some/npm-package

  % npm2nix package.json package.nix


ENTER THE VIRTUAL SHELL (CUSTOM $PATH) WITH ALL
   DEPENDENCIES OF 'npm-package' INSTALLED

  % nix-shell

berlinjs meetup Feb 2015

Is this all that Nix can do?

Hydra

NixOS

NixOps

source / binary model

multi-user

reproducable

multi-version

portable

berlinjs meetup Feb 2015

Thank you

and stay "pure"

First Nix/NixOS meetup

Wed, 4.4. 2015

final wors...

#nix #nixos #berlinjs

Rok Garbas, @garbas

Develop, test and deploy using nix

By Rok Garbas

Develop, test and deploy using nix

  • 1,843