First steps

1st Nix/NixOS meetup Mar 2015 in Berlin

with

Nix

#nix #nixos

Rok Garbas, @garbas

https://garbas.si

NixOS

Nixpkgs

Hydra

Nix

NixOps

Lets meet the family...

berlinjs meetup Feb 2015

What is Nix?

TO INSTALL

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


TO UNINSTALL

  % rm -Rf /nix
  % rm -Rf ~/.nix*
Nix protects me against me.
        
Nix exposes the things I forget.
        
Nix let's me do things multiple times consistently, even on different machines.
        
Nix, the one language to rule them all.
        

Features or

"Why Nix?"

Quotes by Rob Vermas - http://nixer.ghost.io/why/

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>

It was never easier to contribute to linux distirbution

GET LATEST nixpkgs

  % git clone git://github.com/NixOS/nixpkgs.git


FIND A BUG AND FIX IT

  % cd nixpkgs
  % vim ...
  % git commit -m "tig: package updated to 1.2.3"

TEST YOUR CHANGES

  % nix-build -A tig

SEND A PULL REQUEST

Is this all that Nix can do?

Hydra

NixOS

NixOps

source / binary model

multi-user

reproducable

multi-version

portable

Thank you

and stay "pure"

First steps with Nix

By Rok Garbas

First steps with Nix

  • 1,652
Loading comments...

More from Rok Garbas