Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
NixOS - Purely Functional Package Management
Search
yawnt
June 01, 2016
Programming
0
1.4k
NixOS - Purely Functional Package Management
yawnt
June 01, 2016
Tweet
Share
More Decks by yawnt
See All by yawnt
Fun with Elixir and the Erlang VM
yawnt
2
230
Open Source as A Service
yawnt
0
160
Other Decks in Programming
See All in Programming
Azure OpenAI Serviceのプロンプトエンジニアリング入門
tomokusaba
3
600
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
110
SwiftUI Performance 不要なViewの再描画と更新を抑える
bigamitiongit
1
160
"config" ってなんだ? / What is "config"?
okashoi
0
230
新宿ダンジョンを可視化してみた
satoshi7190
2
190
Elm Form Validation
bkuhlmann
0
510
Netty Chicago Java User Group 2024-04-17
sullis
0
170
educure_カリキュラム生操作マニュアル.pdf
linew_official
0
630
コードレビューで学ぶ!Kotlinオブジェクト指向デザインパターン
akkie76
2
190
Front-end application development, Symfony-style(s)
dunglas
2
1.9k
Git Lint
bkuhlmann
4
750
try! Swift Tokyo 2024 参加報告 / try! Swift Tokyo 2024 Report
hironytic
0
200
Featured
See All Featured
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
60
14k
GraphQLの誤解/rethinking-graphql
sonatard
50
9.2k
Automating Front-end Workflow
addyosmani
1355
200k
Producing Creativity
orderedlist
PRO
336
39k
Building Flexible Design Systems
yeseniaperezcruz
318
37k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
How GitHub (no longer) Works
holman
304
140k
How STYLIGHT went responsive
nonsquared
92
4.8k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
124
32k
Git: the NoSQL Database
bkeepers
PRO
422
63k
Transcript
Nix(OS) purely functional package management Fueled by
f(x)
Why is state evil?
Expensive to keep track of mutation
Which in turns means no rollback
Which in turns means no portability
The Nix language
Why?
$ nix-repl > true true > 1 + 1 2
> (a: a + 1) 1 2
We use Nix to describe how to build packages
{ stdenv, fetchurl, perl }: stdenv.mkDerivation { name = "hello-2.1.1";
builder = ./builder.sh; src = fetchurl { url = “${packageURL}; md5 = “${md5hash}; }; inherit perl; }
Packages are immutable once built
Everything lives inside a single directory, the store
“Live” packages are symlinked
Old packages are still in the store, just not accessible
Rollback for free
Multiple versions for free
Multiple envs for free
Puppies for free
Ok, maybe not puppies
$ nix-repl command not found: nix-repl $ nix-shell -p nix-repl
[nix-shell:~]$ nix-repl -v nix-repl v1.1.2 [nix-shell:~]$ exit $ nix-repl command not found: nix-repl
NixOS is a distribution built around Nix
In Nix, to build a package you write a function
In NixOS, to build a system you write a function
configuration.nix
$ fdisk /dev/sda $ mkfs.ext4 -L nixos /dev/sda1 $ mkswap
-L swap /dev/sda2 $ swapon /dev/sda2 $ mount /dev/disk/by-label/nixos /mnt $ nixos-generate-config --root /mnt $ nano /mnt/etc/nixos/configuration.nix $ nixos-install $ reboot
{ config, pkgs, ... }: { imports = [ ./hardware-configuration.nix
]; boot.loader.grub.device = "/dev/sda"; }
Building your system is purely functional
Upgrading is the same as rebuilding from scratch
No /usr, /sbin/, /share
Just /nix/store
Nix(OS) cryoptographically hashes all build inputs
That means built-in versioning
dotfiles, just store ‘em in /nix/store .emacs.d, *wink* *wink* ;)
;)
More than just a distribution
nixops
(hail) hydra
Questions?