Upgrade to Pro — share decks privately, control downloads, hide ads and more …


A513bc1fa519d2fcf5e4e0d9b5500101?s=47 Sibi
January 08, 2022




January 08, 2022

More Decks by Sibi

Other Decks in Technology


  1. NIX/NIXOS ILUGC Sibi Prabakaran Jan 8, 2022

  2. None
  3. AGENDA My experience with Nix/NixOS Introduction Why Nix

  4. MY EXPERIENCE Tried NixOS around 5 years ago Initially used

    nixpkgs in Ubuntu For around ~1.5 years Using NixOS for ~ 1 year Maintainer of various packages
  5. NIX/NIXPKGS/NIXOS Nix: Pure, lazy functional language. Not a general purpose

    language! Used for package description, composition Nixpkgs: Collection of packages. NixOS: Linux + nixpkgs System configuration also managed via Nix
  6. WHY NIX/NIXOS Reproducibility bit identical Multiple versions of a software

    Atomic upgrades and rollbacks Declarative
  7. BASIC WORKFLOW configuration.nix home manager writing script Usage is pretty

    similar to other distros.
  8. NIX LANGUAGE Lazy, Functional and Pure Functions, Sets, Lists etc.

    Reference: https://nixos.wiki/wiki/Nix_Expression_Language
  9. NIX EXPRESSION Code written in Nix language ❯ nix-instantiate --eval

    --expr "2 + 2" 4 ❯ cat example.nix 2 + 2 ❯ nix-instantiate --eval example.nix 4
  10. REAL WORLD NIX CODE Package: systemd service: amber cnx

  11. NIX DERIVATIONS Recipe to build the end product. Reproducible &

    Deterministic ❯ fd -e drv nix /nix/store | head -n 5 /nix/store/ix9j7fmxpfp7c0b2rn95wyy5y1803mya-nixos- manual.desktop.drv /nix/store/2a6ylyfsxb8knnana40fbnmk8ka7q1na-etc- nixos.conf.drv /nix/store/6r57mn57p9rgijr0lsfihkdkk2djkv86-nixos- manpages.drv /nix/store/ppsdnzviyi9q2xqak9qk0w16hpj30frj-nixos.conf.drv /nix/store/bp7flklzjxhm966b0d0pxi85dg4zbqpa-nix-prefetch- cvs.drv
  12. DERVIATION.. ❯ nix show-derivation derivation

  13. COMMUNITY 80,000 packages Easy to add package as compared to

    other distributions Images available for cloud providers nix-community organization
  14. DISADVANTAGES No secure boot. Nix specific issues! Learning curve Debugging

    experience Size of user community Things are still changing: Flakes!