-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnixtalk.html
810 lines (717 loc) · 21.8 KB
/
nixtalk.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Nix Introduction</title>
<meta name="author" content="(Kevin Quick & David Johnson)"/>
<style type="text/css">
.underline { text-decoration: underline; }
</style>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/reveal.js/3.0.0/css/reveal.css"/>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/reveal.js/3.0.0/css/theme/night.css" id="theme"/>
<link rel="stylesheet" href="./nixtalk.css"/>
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'http://cdn.jsdelivr.net/reveal.js/3.0.0/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section id="sec-title-slide"><h1 class="title">Nix Introduction</h1><h2 class="author">Kevin Quick & David Johnson</h2><p class="date">Created: 2017-08-05 Sat 16:00</p>
</section>
<section>
<section id="slide-orgdc05ff2">
<h2 id="orgdc05ff2">Sales Pitch</h2>
<ul>
<li>Why use nix to install packages?</li>
<li>Reproducible builds</li>
<li>Full dependency integrity</li>
<li>Large integrated language ecosystem</li>
<li>Parallel versions of the same package</li>
<li>Global caching</li>
<li>Encompasses: builds, deployments, system management</li>
</ul>
</section>
</section>
<section>
<section id="slide-orgbb18992">
<h2 id="orgbb18992">nix is a package manager</h2>
<ul>
<li>(… and a language, and an OS)</li>
<li>nix is a package manager
<ul>
<li>nix-env high level: calls the other tools.</li>
<li>nix-shell, nix-store, nix-build</li>
</ul></li>
<li>nix language
<ul>
<li>declarative</li>
<li>dynamic typing
<ul>
<li>resolved at runtime</li>
<li>no implicit coersion</li>
</ul></li>
<li>A DSL to generate <code>IO PKG</code></li>
</ul></li>
<li>Invoke builders
<ul>
<li>derivation: recorded pure result of evaluation</li>
<li>output: running an engine to realize the derivation</li>
</ul></li>
</ul>
</section>
</section>
<section>
<section id="slide-org8c5a94c">
<h2 id="org8c5a94c">Roadmap</h2>
<ol>
<li class="fragment highlight-green">Define a pure language</li>
<li>Evaluate language to determine goals: derivations</li>
<li>Storing builds</li>
<li>Realize derivations (IO)</li>
<li>Compose results into environments</li>
</ol>
</section>
</section>
<section>
<section id="slide-org2268b68">
<h2 id="org2268b68">nix language</h2>
<p>
<a href="https://nixos.org/nix/manual">https://nixos.org/nix/manual</a>
</p>
<ul>
<li><p>
sets of attr/val
</p>
<div class="org-src-container">
<pre class="src src-nix"> > <span style="color: #fcaf3e;">a</span> = { <span style="color: #fcaf3e;">x</span> = 1; <span style="color: #fcaf3e;">y</span> = <span style="color: #e9b96e;">"foo"</span>; <span style="color: #fcaf3e;">z</span> = <span style="color: #e9b2e3; font-weight: bold;">https://lots.of/pipes</span>; };
</pre>
</div></li>
<li><p>
standard set operation: //
</p>
<div class="org-src-container">
<pre class="src src-nix"> > <span style="color: #fcaf3e;">b</span> = { <span style="color: #fcaf3e;">x</span> = 3; <span style="color: #fcaf3e;">r</span> = [2 <span style="color: #e9b96e;">"hi"</span>]; <span style="color: #fcaf3e;">blob</span> = { <span style="color: #fcaf3e;">t</span>=1; }; };
> a // b
{ <span style="color: #fcaf3e;">r</span> = [...]; <span style="color: #fcaf3e;">x</span> = 3; <span style="color: #fcaf3e;">y</span> = <span style="color: #e9b96e;">"foo"</span>; <span style="color: #fcaf3e;">z</span> = ... }
</pre>
</div></li>
<li><p>
functions
</p>
<pre class="example">
> f = i: j: i + j.x
> f 9 a
10
</pre></li>
<li>lazy evaluation</li>
<li>let and rec bindings</li>
</ul>
</section>
</section>
<section>
<section id="slide-orgaafb159">
<h2 id="orgaafb159">nix language files</h2>
<ul>
<li><p>
convention: file stores a function
</p>
<pre class="example">
$ cat myfun.nix
{ i, j }:
i + j.x
</pre></li>
<li><p>
conventionally one argument: a set of values
</p>
<pre class="example">
> g = import myfun.nix
> g { i=9; j=a; }
10
> c = {i=9;}
> g (c // { j=a; })
10
</pre></li>
<li><p>
"inherit x y;" is syntactic sugar for "x=x; y=y;"
</p>
<pre class="example">
> j = a
> g { inherit j; i=9; } == g { i=9; j=j; }
true
</pre></li>
</ul>
</section>
</section>
<section>
<section id="slide-org7883cd5">
<h2 id="org7883cd5">Roadmap</h2>
<ol>
<li>Define a pure language</li>
<li class="fragment highlight-green">Evaluate language to determine goals: derivations</li>
<li>Storing builds</li>
<li>Realize Derivations (IO)</li>
<li>Compose results into environments</li>
</ol>
</section>
</section>
<section>
<section id="slide-orga858560">
<h2 id="orga858560">Create Derivations</h2>
<ul>
<li>What is a Derivation?
<ul>
<li>instructions on how to build something + references to every dependency</li>
<li>Implemented as sets, but treated specially during evaluation.
<ul>
<li>Perform side effects like producing build output</li>
</ul></li>
<li>derivation is the most important primitive in nix
<ul>
<li>Requires a name</li>
<li>Requires a builder (script for building the package)
<ul>
<li>All attributes are passed as environment variables to the build.</li>
</ul></li>
<li>Requires a src
<ul>
<li>can use local source, or perform IO and fetch over network</li>
</ul></li>
</ul></li>
</ul></li>
</ul>
</section>
<section id="slide-org00368a0">
<h3 id="org00368a0">Writing Derivations</h3>
<ul>
<li>In practice you'll use wrappers
<ul>
<li>e.g., runCommand, writeScriptBin, mkDerivation</li>
<li><p>
mkDerivation uses setup.sh by default
</p>
<p class="verse">
<a href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh">https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh</a><br />
</p></li>
<li>fetchUrl, fetchFromGitHub, fetchFromGitLab, etc.
<ul>
<li>fixed output derivations.</li>
<li>Perform network IO, but "pure" because they perform "hash
matching".</li>
</ul></li>
</ul></li>
</ul>
</section>
<section id="slide-org7b63d6c">
<h3 id="org7b63d6c">Sample derivation</h3>
<pre class="example">
{ pkgs ? import <nixpkgs> {} }:
# pkgs parameter has a default; it lazily imports
# all of nixpkgs namespace into scope
pkgs.stdenv.mkDerivation {
name = "hello-2.9";
# src itself is a derivation
# All derivations are stored in the /nix/store, before being realized
src = pkgs.fetchurl {
url = "mirror://gnu/hello/${name}.tar.gz";
sha256 = "19qy37gkasc4csb1d3bdiz9snn8mir2p3aj0jgzmfv0r2hi7mfzc";
};
};
}
</pre>
</section>
</section>
<section>
<section id="slide-org93e797a">
<h2 id="org93e797a">Roadmap</h2>
<ol>
<li>Define a pure language</li>
<li>Evaluate language to determine goals: derivations</li>
<li class="fragment highlight-green">Storing builds</li>
<li>Realize Derivations (IO)</li>
<li>Compose results into environments</li>
</ol>
</section>
</section>
<section>
<section id="slide-org5113097">
<h2 id="org5113097">nix store</h2>
<ul>
<li>Building a derivation puts build output into the "store"
<ul>
<li>System global directory tree</li>
</ul></li>
<li>Nothing is in scope
<ul>
<li>dependencies passed in to derivation as args</li>
<li>args reference store locations</li>
</ul></li>
</ul>
</section>
<section id="slide-org3ff0d94">
<h3 id="org3ff0d94">Unique hashes</h3>
<ul>
<li><p>
each store entry identified by hash
</p>
<pre class="example">
$ ls -CF /nix/store/q0crs4bg5vgl9cjpp9yxysd1w97inr0-git-2.13.2/
bin/ etc/ lib/ libexec/ share/
</pre></li>
<li>every package and every version has unique hash
<ul>
<li>closure over build-time inputs</li>
</ul></li>
<li>can have multiple versions
<ul>
<li>each store location is isolated</li>
<li>all dependencies are <span class="underline">explicit</span> in the derivation</li>
</ul></li>
</ul>
</section>
</section>
<section>
<section id="slide-org792b442">
<h2 id="org792b442">Roadmap</h2>
<ol>
<li>Define a pure language</li>
<li>Evaluate language to determine goals: derivations</li>
<li>Storing builds</li>
<li class="fragment highlight-green">Realize Derivations (IO)</li>
<li>Compose results into environments</li>
</ol>
</section>
</section>
<section>
<section id="slide-org8f93bf4">
<h2 id="org8f93bf4">Realize derivations</h2>
<ul>
<li>Phase distinction, instantiation & realization</li>
<li>nix (<a href="https://github.com/nixos/nix">https://github.com/nixos/nix</a>)
<ul>
<li>Heart of nix system, 4 C++ libraries, dozen or so utilities</li>
</ul></li>
<li>nix-instantiate
<ul>
<li><p>
Creates build instructions, calculates hash
</p>
<p class="verse">
<a href="https://gist.github.com/dmjio/7e5a024f95fe18aa34f8fea69ecebc74#file-derivation-txt-L2">https://gist.github.com/dmjio/7e5a024f95fe18aa34f8fea69ecebc74#file-derivation-txt-L2</a><br />
<a href="https://github.com/NixOS/nix/blob/master/src/libstore/store-api.cc#L104">https://github.com/NixOS/nix/blob/master/src/libstore/store-api.cc#L104</a><br />
</p></li>
<li>Will exploit network binary caches of store path</li>
</ul></li>
<li>nix-store -r
<ul>
<li>Build ("realize") package from derivation description</li>
<li>Can watch evaluation through setup.sh by tracing "set -x"</li>
</ul></li>
<li>nix-build
<ul>
<li>Creates derivation, builds package, installs in store</li>
<li>Equivalent to calling 'nix-store -r $(nix-instantiate default.nix)'</li>
</ul></li>
</ul>
</section>
<section id="slide-org138f8b7">
<h3 id="org138f8b7">Build phases</h3>
<ul>
<li>Builds go through phases
<ul>
<li>pre/postFetch, pre/postBuild, pre/postInstall. etc/</li>
<li>Package builds are split into phases to make it easier to
override specific parts of the build (e.g., unpacking the
sources or installing the binaries).</li>
<li>New phases can be defined (haskell packages does this,
e.g. haddockPhase)</li>
<li>Default phase behavior can be seen in setup.sh</li>
</ul></li>
<li><p>
nix-shell
</p>
<pre class="example">
$ nix-shell $(nix-instantiate default.nix)
</pre>
<ul>
<li>Useful for interactively building derivations</li>
<li>Puts a user into a shell with environment variables from the
derivation present</li>
<li>Can run the build with `genericBuild`</li>
</ul></li>
</ul>
</section>
</section>
<section>
<section id="slide-orgf9f8952">
<h2 id="orgf9f8952">Roadmap</h2>
<ol>
<li>Define a pure language</li>
<li>Evaluate language to determine goals: derivations</li>
<li>Storing builds</li>
<li>Realize derivations (IO)</li>
<li class="fragment highlight-green">Compose results into environments</li>
</ol>
</section>
</section>
<section>
<section id="slide-orga717c8d">
<h2 id="orga717c8d">profiles expose packages</h2>
<ul>
<li>Each exe or lib has a unique store location</li>
<li>Want a useable environment to run multiple tools</li>
<li>nix-env creates profiles
<img src="nix-user-environments.png" alt="nix-user-environments.png" /></li>
</ul>
</section>
</section>
<section>
<section id="slide-org3e178fb">
<h2 id="org3e178fb">Minimizing for Effectiveness</h2>
<ul>
<li>Conventional package managers install globally</li>
<li>This is an anti-pattern using nix</li>
<li>nix installs into global store, and then exposes locally
<ul>
<li>use only for generics, like vi and emacs</li>
</ul></li>
<li>let projects specify the packages and versions needed
<ul>
<li>nix-build
<ul>
<li>local "<code>result</code>" symlink instead of profile</li>
</ul></li>
<li>nix-shell
<ul>
<li>shell with build environment, but doesn't build current
package</li>
</ul></li>
</ul></li>
</ul>
</section>
</section>
<section>
<section id="slide-orgb55f657">
<h2 id="orgb55f657">nixpkgs</h2>
<ul>
<li>A large set of ready-made derivations</li>
<li>Each function is (ultimately) the mkDerivation</li>
<li>channels: tarball of packages
<ul>
<li><p>
Updates of packages
</p>
<pre class="example">
$ nix-channel --update
</pre></li>
<li>Stored in the store</li>
<li>Can rollback</li>
<li>Multiple channels</li>
</ul></li>
<li>hydra
<ul>
<li>public package builder daemon</li>
<li>supplies binaries and bdiffs to nix-env</li>
</ul></li>
</ul>
</section>
<section id="slide-org73cbda6">
<h3 id="org73cbda6">Huge collection of files</h3>
<ul>
<li><a href="https://github.com/nixos/nixpkgs">https://github.com/nixos/nixpkgs</a></li>
<li>Jul 29, 2017:
<ul>
<li>111685 commits</li>
<li>~300/wk</li>
<li>1290 contributors</li>
</ul></li>
</ul>
</section>
</section>
<section>
<section id="slide-orgd97c3d4">
<h2 id="orgd97c3d4">NixOS</h2>
<ul>
<li>Built on nix language</li>
<li>Adds "system" profile, containing kernel, boot image</li>
<li>Builder to update grub to use new boot image</li>
<li>Builder to write /etc configuration files from nix</li>
<li>Uses same profile symlinks
<ul>
<li>All kernels and boots available in the store</li>
<li>Rollback (or forward) is trivial (grub menu entries)</li>
</ul></li>
<li><del>Can</del> Should use nixpkgs outside of NixOS</li>
</ul>
</section>
</section>
<section>
<section id="slide-org427a9c0">
<h2 id="org427a9c0">Language ecosystems</h2>
<ul>
<li>Each language has its own "package" concept</li>
<li>Nix has tools/language elements to support different languages</li>
<li>Check online documentation for your language</li>
</ul>
</section>
</section>
<section>
<section id="slide-org5e3aa41">
<h2 id="org5e3aa41">cabal2nix</h2>
<ul>
<li>Tool to builds a nix specification from a cabal file</li>
<li>hydra builds
<ul>
<li>cabal2nix run on LTS yaml file</li>
<li>Generates new packages specification</li>
<li><p>
pkgs.haskellPackages.PKG (11,257 pkgs)
</p>
<p class="verse">
<a href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-packages/hackage-packages.nix">https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-packages/hackage-packages.nix</a><br />
</p></li>
<li>hydra rebuilds from new package descriptions</li>
<li>For new packages or newer versions
<ul>
<li>use cabal2nix to generate a local file</li>
</ul></li>
</ul></li>
<li>Input sources:</li>
</ul>
<pre class="example">
$ cabal2nix /home/kquick/crucible/crucible-matlab > crucible-matlab.nix
$ cabal2nix cabal://language-sally > language-sally.nix
$ cabal2nix cabal://containers-4.3.1 > containers-4.3.1.nix
$ cabal2nix https://github.com/GaloisInc/crucible [-rev 98ac3d5] > crucible.nix
</pre>
</section>
</section>
<section>
<section id="slide-org80ec166">
<h2 id="org80ec166">INSTALLING a local haskell project</h2>
<ul>
<li><p>
high-level config specifying new/missing components
</p>
<pre class="example">
$ nix-env -f myfile -iA haskellPackages.project_a
</pre></li>
<li>copies source to store
<ul>
<li>assigns hash</li>
<li>builds from that source</li>
<li>maintains closure chain/reproducability</li>
</ul></li>
</ul>
</section>
</section>
<section>
<section id="slide-org1b8bd57">
<h2 id="org1b8bd57">DEVELOPING a local haskell project</h2>
<ul>
<li>nix-shell</li>
<li>high-level config specifying new/missing components</li>
<li>instantiates the build environment
(i.e. builds all dependencies)</li>
<li>does not build current target</li>
<li>normal "cabal build" process</li>
<li>dependencies just need a .nix specification
<ul>
<li>+ don't need to be checked out to build locally</li>
<li>+ built once</li>
<li>- full rebuild if changed, no partial rebuilds</li>
</ul></li>
</ul>
</section>
</section>
<section>
<section id="slide-org9aa7083">
<h2 id="org9aa7083">crucible</h2>
<ul>
<li>top level package config</li>
<li>bash script to run cabal2nix for localdirs or (if not present),
github or hackage.</li>
<li><a href="https://github.com/kquick/crucible_nix">https://github.com/kquick/crucible_nix</a></li>
<li>Recommended
<ul>
<li>Use Gabriel Gonzalez's excellent description:
<a href="https://github.com/Gabriel439/haskell-nix">https://github.com/Gabriel439/haskell-nix</a></li>
<li>Also John Wiegley's work:
<a href="https://github.com/jwiegley/nix-config">https://github.com/jwiegley/nix-config</a></li>
</ul></li>
</ul>
</section>
<section id="slide-org56e8c1f">
<h3 id="org56e8c1f">Sample specification</h3>
<div class="org-src-container">
<pre class="src src-nix">{ stdenv, fetchurl, pkgconfig, libgphoto2, libexif, popt, gettext
, libjpeg, readline, libtool
}:
stdenv.mkDerivation <span style="color: #b4fa70;">rec</span> {
<span style="color: #fcaf3e;">name</span> = <span style="color: #e9b96e;">"gphoto2-2.5.11"</span>;
<span style="color: #fcaf3e;">src</span> = fetchurl {
<span style="color: #fcaf3e;">url</span> = <span style="color: #e9b96e;">"mirror://sourceforge/gphoto/${name}.tar.bz2"</span>;
<span style="color: #fcaf3e;">sha256</span> = <span style="color: #e9b96e;">"1sgr6rsvzzagcwhc8fxbnvz3k02wr2hab0vrbvcb04k5l3b48a1r"</span>;
};
<span style="color: #fcaf3e;">nativeBuildInputs</span> = [ pkgconfig gettext libtool ];
<span style="color: #fcaf3e;">buildInputs</span> = [ libgphoto2 libexif popt libjpeg readline ];
<span style="color: #fcaf3e;">meta</span> = <span style="color: #b4fa70;">with</span> stdenv.lib; {
<span style="color: #fcaf3e;">description</span> = <span style="color: #e9b96e;">"A ready to use set of digital camera software applications"</span>;
<span style="color: #fcaf3e;">homepage</span> = <span style="color: #e9b2e3; font-weight: bold;">http://www.gphoto.org/</span>;
<span style="color: #fcaf3e;">license</span> = licenses.gpl2Plus;
<span style="color: #fcaf3e;">platforms</span> = platforms.unix;
<span style="color: #fcaf3e;">maintainers</span> = [ maintainers.jcumming ];
};
}
</pre>
</div>
</section>
</section>
<section>
<section id="slide-org2ec5a47">
<h2 id="org2ec5a47">REPL</h2>
<ul>
<li><p>
REPL tool for language and inspection
</p>
<pre class="example">
$ nix-repl
> :l <nixpkgs>
> pkgs.git.m<TAB>
pkgs.git.makeFlags pkgs.git.meta
> pkgs.git.meta.description
"Distributed version control system"
</pre></li>
</ul>
</section>
</section>
<section>
<section id="slide-org2446950">
<h2 id="org2446950">Miscellaneous</h2>
<ul>
<li>Local builds are not incremental</li>
<li>Attributes are specific but not versioned
<ul>
<li>When needed, a new version-specific attribute is created</li>
</ul></li>
<li><p>
Store can get big (that's called efficiency)
</p>
<pre class="example">
$ nix-env --delete-generations 19 20 17
$ nix-env --delete-generations 30d
$ nix-collect-garbage
</pre>
<ul>
<li>The GC roots are the profile versions.</li>
<li>Store locations unreachable from profile roots are removed</li>
</ul></li>
<li>Prefer nix-shell to nix-env
<ul>
<li>Keep your main environment minimal</li>
</ul></li>
</ul>
</section>
</section>
<section>
<section id="slide-org05bf56d">
<h2 id="org05bf56d">Examples</h2>
<ul>
<li>CyberChaff
<ul>
<li><p>
Build
</p>
<p class="verse">
<a href="https://gist.github.com/e6ad693c41b49b925557fd52aaaf6a42">https://gist.github.com/e6ad693c41b49b925557fd52aaaf6a42</a><br />
</p></li>
</ul></li>
<li>DDOS-gui (<a href="http://ddos.dmj.io">http://ddos.dmj.io</a>)
<ul>
<li><p>
Build
</p>
<p class="verse">
<a href="https://gist.github.com/dmjio/3a1d977fe9e537ca2ad6efcd3a708d4b">https://gist.github.com/dmjio/3a1d977fe9e537ca2ad6efcd3a708d4b</a><br />
</p></li>
</ul></li>
<li><p>
NixOS module, deployment
</p>
<p class="verse">
<a href="https://gist.github.com/dmjio/7c0cb81113c7c46cf35edceb5c7960ac">https://gist.github.com/dmjio/7c0cb81113c7c46cf35edceb5c7960ac</a><br />
<a href="https://gist.github.com/dmjio/7705f8c112506f8e93ee09271ccdd14e">https://gist.github.com/dmjio/7705f8c112506f8e93ee09271ccdd14e</a><br />
</p></li>
</ul>
</section>
</section>
<section>
<section id="slide-org91aeca6">
<h2 id="org91aeca6">THE END</h2>
<ul>
<li>Nix language
<ul>
<li><a href="https://nixos.org/nix/manual">https://nixos.org/nix/manual</a></li>
</ul></li>
<li>Nix package specification (builders, attributes, language support,
etc.)
<ul>
<li><a href="https://nixos.org/nixpkgs/manual/">https://nixos.org/nixpkgs/manual/</a></li>
</ul></li>
<li>Nix package list
<ul>
<li><a href="https://nixos.org/nixos/packages.html">https://nixos.org/nixos/packages.html</a></li>
</ul></li>
<li>NixOS
<ul>
<li><a href="https://nixos.org">https://nixos.org</a></li>
</ul></li>
<li>Nix declarative deployment (viz. Kubernetes)
<ul>
<li><a href="https://nixos.org/nixops">https://nixos.org/nixops</a></li>
</ul></li>
</ul>
</section>
</section>
</div>
</div>
<script src="http://cdn.jsdelivr.net/reveal.js/3.0.0/lib/js/head.min.js"></script>
<script src="http://cdn.jsdelivr.net/reveal.js/3.0.0/js/reveal.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: false,
center: true,
slideNumber: 'c',
rollingLinks: false,
keyboard: true,
overview: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
transitionSpeed: 'default',
multiplex: {
secret: '', // null if client
id: '', // id, obtained from socket.io server
url: '' // Location of socket.io server
},
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }]
});
</script>
</body>
</html>