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
|
<refentry>
<refnamediv>
<refname>nix-store</refname>
<refpurpose>manipulate or query the Nix store</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>nix-store</command>
<arg rep='repeat'><option>--verbose</option></arg>
<arg rep='repeat'><option>-v</option></arg>
<arg><option>--keep-failed</option></arg>
<arg><option>-K</option></arg>
<arg choice='plain'><replaceable>operation</replaceable></arg>
<arg rep='repeat'><replaceable>options</replaceable></arg>
<arg rep='repeat'><replaceable>arguments</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection>
<title>Description</title>
<para>
The command <command>nix-store</command> performs primitive
operations on the Nix store. You generally do not need to run
this command manually.
</para>
<para>
<command>nix-store</command> takes exactly one
<emphasis>operation</emphasis> flag which indicates the
subcommand to be performed. These are documented below.
</para>
</refsection>
<!--######################################################################-->
<refsection>
<title>Common options</title>
<para>
This section lists the options that are common to all
operations. These options are allowed for every subcommand,
though they may not always have an effect.
</para>
<variablelist>
&opt-verbose;
<varlistentry>
<term><option>--keep-failed</option> / <option>-K</option></term>
<listitem>
<para>
Specifies that in case of a build failure, the temporary directory
(usually in <filename>/tmp</filename>) in which the build takes
place should not be deleted. The path of the build directory is
printed as an informational message.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<!--######################################################################-->
<refsection>
<title>Environment variables</title>
<para>
The following environment variables affect the behaviour of
<command>nix-store</command>.
</para>
<variablelist>
<varlistentry>
<term><envar>TMPDIR</envar>=<replaceable>path</replaceable></term>
<listitem>
<para>
Use the directory <replaceable>path</replaceable> to store
temporary files. In particular, this includes temporary
build directories; these can take up substantial amounts
of disk space. The default is <filename>/tmp</filename>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<!--######################################################################-->
<refsection>
<title>Operation <option>--realise</option></title>
<refsection>
<title>Synopsis</title>
<cmdsynopsis>
<command>nix-store</command>
<group choice='req'>
<arg choice='plain'><option>--realise</option></arg>
<arg choice='plain'><option>-r</option></arg>
</group>
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
</cmdsynopsis>
</refsection>
<refsection>
<title>Description</title>
<para>
The operation <option>--install</option> realises in the file
system the store expressions stored in
<replaceable>paths</replaceable>. If these expressions are
derivation expressions, they are first
<emphasis>normalised</emphasis> into a closure expression.
This may happen in two ways. First, the corresponding closure
expression (the <emphasis>successor</emphasis>) may already
known (either because the build has already been performed, or
because a successor was explicitly registered through the
<option>--successor</option> operation). Otherwise, the build
action described by the derivation is performed, and a closure
expression is computed by scanning the result of the build for
references to other paths in the store.
</para>
<para>
The paths of the closure expression corresponding to each
expression in <replaceable>paths</replaceable> is printed on
standard output.
</para>
</refsection>
</refsection>
<!--######################################################################-->
<refsection>
<title>Operation <option>--delete</option></title>
<refsection>
<title>Synopsis</title>
<cmdsynopsis>
<command>nix-store</command>
<group choice='req'>
<arg choice='plain'><option>--delete</option></arg>
<arg choice='plain'><option>-d</option></arg>
</group>
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
</cmdsynopsis>
</refsection>
<refsection>
<title>Description</title>
<para>
The operation <option>--delete</option> unconditionally deletes the
paths <replaceable>paths</replaceable> from the Nix store. It is an
error to attempt to delete paths outside of the store.
</para>
<warning>
<para>
This operation should almost never be called directly, since no
attempt is made to verify that no references exist to the paths to
be deleted. Therefore, careless deletion can result in an
inconsistent system. Deletion of paths in the store is done by the
garbage collector (which uses <option>--delete</option> to delete
unreferenced paths).
</para>
</warning>
</refsection>
</refsection>
<!--######################################################################-->
<refsection>
<title>Operation <option>--query</option></title>
<refsection>
<title>Synopsis</title>
<cmdsynopsis>
<command>nix-store</command>
<group choice='req'>
<arg choice='plain'><option>--query</option></arg>
<arg choice='plain'><option>-q</option></arg>
</group>
<group choice='req'>
<arg choice='plain'><option>--list</option></arg>
<arg choice='plain'><option>-l</option></arg>
<arg choice='plain'><option>--requisites</option></arg>
<arg choice='plain'><option>-R</option></arg>
<arg choice='plain'><option>--predecessors</option></arg>
<arg choice='plain'><option>--graph</option></arg>
</group>
<arg><option>--normalise</option></arg>
<arg><option>-n</option></arg>
<arg><option>--force-realise</option></arg>
<arg><option>-f</option></arg>
<arg choice='plain' rep='repeat'><replaceable>args</replaceable></arg>
</cmdsynopsis>
</refsection>
<refsection>
<title>Description</title>
<para>
The operation <option>--query</option> displays various bits
of information about store expressions or store paths. The
queries are described below. At most one query can be
specified. The default query is <option>--list</option>.
</para>
</refsection>
<refsection>
<title>Common query options</title>
<variablelist>
<varlistentry>
<term><option>--normalise</option> / <option>-n</option></term>
<listitem>
<para>
For those queries that take a Nix store expression, this
option causes those expressions to be normalised first.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--force-realise</option> / <option>-f</option></term>
<listitem>
<para>
For those queries that take a Nix store expression, this
option causes those expressions to be realised first.
This is just a short-cut for the common idiom
</para>
<screen>
nix-store --realise /nix/store/bla.store
x=`nix-store --query --normalise /nix/store/bla.store
<emphasis>(do something with the path $x</emphasis></screen>
<para>
which using this flag can be written as
</para>
<screen>
x=`nix-store --query --normalise --force-realise /nix/store/bla.store
<emphasis>(do something with the path $x</emphasis></screen>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection id='nixref-queries'>
<title>Queries</title>
<variablelist>
<varlistentry>
<term><option>--list</option> / <option>-l</option></term>
<listitem>
<para>
Prints out the <emphasis>output paths</emphasis> of the
store expressions indicated by the identifiers
<replaceable>args</replaceable>. In the case of a
derivation expression, these are the paths that will be
produced when the derivation is realised. In the case
of a closure expression, these are the paths that were
produced the derivation expression of which the closure
expression is a successor.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--requisites</option> / <option>-R</option></term>
<listitem>
<para>
Prints out the requisite paths of the store expressions
indicated by the identifiers
<replaceable>args</replaceable>. The requisite paths of
a Nix expression are the paths that need to be present
in the system to be able to realise the expression.
That is, they form the <emphasis>closure</emphasis> of
the expression in the file system (i.e., no path in the
set of requisite paths points to anything outside the
set of requisite paths).
</para>
<para>
The notion of requisite paths is very useful when one
wants to distribute store expressions. Since they form a
closure, they are the only paths one needs to distribute
to another system to be able to realise the expression
on the other system.
</para>
<para>
This query is generally used to implement various kinds
of deployment. A <emphasis>source deployment</emphasis>
is obtained by distributing the requisite paths of a
derivation expression. A <emphasis>binary
deployment</emphasis> is obtained by distributing the
requisite paths of a closure expression. A
<emphasis>cache deployment</emphasis> is obtained by
distributing the requisite paths of a derivation
expression and specifying the option
<option>--include-successors</option>. This will
include not just the paths of a source and binary
deployment, but also all expressions and paths of
subterms of the source. This is useful if one wants to
realise on the target system a Nix expression that is
similar but not quite the same as the one being
distributed, since any common subterms will be reused.
</para>
<para>
This query has a number of options:
</para>
<variablelist>
<varlistentry>
<term><option>--exclude-exprs</option></term>
<listitem>
<para>
Excludes the paths of store expressions. This
causes the closure property to be lost, that is,
the resulting set of paths is not enough to ensure
realisibility.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--include-successors</option></term>
<listitem>
<para>
Also include the requisites of successors (normal forms).
Only the requisites of <emphasis>known</emphasis>
successors are included, i.e., the normal forms of
derivation expressions that have never been normalised will
not be included.
</para>
<para>
Note that not just the successor of a derivation expression
will be included, but also the successors of all input
expressions of that derivation expression. I.e., all
normal forms of subterms involved in the normalisation of
the top-level term are included.
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--predecessors</option></term>
<listitem>
<para>
For each store expression stored at paths
<replaceable>args</replaceable>, prints its
<emphasis>predecessors</emphasis>. A derivation
expression <varname>p</varname> is a predecessor of a
store expression <varname>q</varname> iff
<varname>q</varname> is a successor of
<varname>p</varname>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--graph</option></term>
<listitem>
<para>
Prints a graph of the closure of the store expressions
identified by <replaceable>args</replaceable> in the
format of the <command>dot</command> tool of AT&T's
GraphViz package.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
</refsection>
<!--######################################################################-->
<refsection>
<title>Operation <option>--successor</option></title>
<refsection>
<title>Synopsis</title>
<cmdsynopsis>
<command>nix-store</command>
<arg choice='req'><option>--successor</option></arg>
<arg choice='plain'
rep='repeat'><replaceable>srcpath</replaceable> <replaceable>sucpath</replaceable></arg>
</cmdsynopsis>
</refsection>
<refsection>
<title>Description</title>
<para>
The operation <option>--successor</option> registers that the
closure expression in <replaceable>sucpath</replaceable> is a
successor of the derivation expression in
<replaceable>srcpath</replaceable>. This is used to implement
binary deployment.
</para>
</refsection>
</refsection>
<!--######################################################################-->
<refsection>
<title>Operation <option>--substitute</option></title>
<refsection>
<title>Synopsis</title>
<cmdsynopsis>
<command>nix-store</command>
<arg choice='req'><option>--substitute</option></arg>
<arg choice='plain'
rep='repeat'><replaceable>srcpath</replaceable> <replaceable>subpath</replaceable></arg>
</cmdsynopsis>
</refsection>
<refsection>
<title>Description</title>
<para>
The operation <option>--substitute</option> registers that the
store path <replaceable>srcpath</replaceable> can be built by
realising the derivation expression in
<replaceable>subpath</replaceable>. This is used to implement
binary deployment.
</para>
</refsection>
</refsection>
<!--######################################################################-->
<refsection>
<title>Operation <option>--verify</option></title>
<refsection>
<title>Synopsis</title>
<cmdsynopsis>
<command>nix-store</command>
<arg choice='req'><option>--verify</option></arg>
</cmdsynopsis>
</refsection>
<refsection>
<title>Description</title>
<para>
The operation <option>--verify</option> verifies the internal
consistency of the Nix database, and the consistency between
the Nix database and the Nix store. Any inconsistencies
encountered are automatically repaired. Inconsistencies are
generally the result of the Nix store or database being
modified by non-Nix tools, or of bugs in Nix itself.
</para>
</refsection>
</refsection>
</refentry>
<!--
local variables:
sgml-parent-document: ("book.xml" "refentry")
end:
-->
|