aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/nix-store-reference.xml
blob: 686fe4c15643eb3f1cd494be87d68aa5e44024c5 (plain)
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
<refentry>
  <refnamediv>
    <refname>nix-store</refname>
    <refpurpose>manipulate or query the Nix store</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <cmdsynopsis>
      <command>nix-store</command>
      <group choice='opt'>
        <arg><option>--path</option></arg>
        <arg><option>-p</option></arg>
      </group>
      <group choice='opt' rep='repeat'>
        <arg><option>--verbose</option></arg>
        <arg><option>-v</option></arg>
      </group>
      <group choice='opt' rep='repeat'>
        <arg><option>--keep-failed</option></arg>
        <arg><option>-K</option></arg>
      </group>
      <arg choice='plain'><replaceable>operation</replaceable></arg>
      <arg rep='repeat'><replaceable>options</replaceable></arg>
      <arg rep='repeat'><replaceable>arguments</replaceable></arg>
    </cmdsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title>Description</title>

    <para>
      The command <command>nix</command> provides access to the Nix store. This
      is the (set of) path(s) where Nix expressions and the file system objects
      built by them are stored.
    </para>

    <para>
      <command>nix</command> has many subcommands called
      <emphasis>operations</emphasis>.  These are individually documented
      below.  Exactly one operation must always be provided.
    </para>

  </refsect1>

  <refsect1>
    <title>Common Options</title>

    <para>
      In this section the options that are common to all Nix operations are
      listed.  These options are allowed for every subcommand (although they
      may not always have an effect).
    </para>

    <variablelist>

      <varlistentry>
        <term><option>--path</option></term>
        <listitem>
          <para>
            Indicates that any identifier arguments to the operation are paths
            in the store rather than identifiers.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--verbose</option></term>
        <listitem>
          <para>
            Increases the level of verbosity of diagnostic messages printed on
            standard error.  For each Nix operation, the information printed on
            standard output is well-defined and specified below in the
            respective sections.  Any diagnostic information is printed on
            standard error, never on standard output.
          </para>

          <para>
            This option may be specified repeatedly.  Currently, the following
            verbosity levels exist:
          </para>

          <variablelist>
            <varlistentry>
              <term>0</term>
              <listitem>
                <para>
                  Print error messages only.
                </para>
              </listitem>
            </varlistentry>
            <varlistentry>
              <term>1</term>
              <listitem>
                <para>
                  Print informational messages.
                </para>
              </listitem>
            </varlistentry>
            <varlistentry>
              <term>2</term>
              <listitem>
                <para>
                  Print even more informational messages.
                </para>
              </listitem>
            </varlistentry>
            <varlistentry>
              <term>3</term>
              <listitem>
                <para>
                  Print messages that should only be useful for debugging.
                </para>
              </listitem>
            </varlistentry>
            <varlistentry>
              <term>4</term>
              <listitem>
                <para>
                  <quote>Vomit mode</quote>: print vast amounts of debug
                  information.
                </para>
              </listitem>
            </varlistentry>
          </variablelist>

        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--keep-failed</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>

  </refsect1>


  <!--######################################################################-->

  <refsect1>
    <title>Operation <option>--install</option></title>

    <refsect2>
      <title>Synopsis</title>
      <cmdsynopsis>
        <command>nix</command>
        <group>
          <arg><option>--install</option></arg>
          <arg><option>-i</option></arg>
        </group>
        <arg choice='plain' rep='repeat'><replaceable>ids</replaceable></arg>
      </cmdsynopsis>
    </refsect2>

    <refsect2>
      <title>Description</title>
            
      <para>
        The operation <option>--install</option> realises the Nix expressions
        identified by <replaceable>ids</replaceable> in the file system.  If
        these expressions are derivation expressions, they are first
        normalised.  That is, their target paths are are built, unless a normal
        form is already known.
      </para>

      <para>
        The identifiers of the normal forms of the given Nix expressions are
        printed on standard output.
      </para>

    </refsect2>
            
  </refsect1>


  <!--######################################################################-->

  <refsect1>
    <title>Operation <option>--delete</option></title>

    <refsect2>
      <title>Synopsis</title>
      <cmdsynopsis>
        <command>nix</command>
        <group>
          <arg><option>--delete</option></arg>
          <arg><option>-d</option></arg>
        </group>
        <arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
      </cmdsynopsis>
    </refsect2>

    <refsect2>
      <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>

    </refsect2>
            
  </refsect1>


  <!--######################################################################-->

  <refsect1>
    <title>Operation <option>--query</option></title>

    <refsect2>
      <title>Synopsis</title>
      <cmdsynopsis>
        <command>nix</command>
        <group>
          <arg><option>--query</option></arg>
          <arg><option>-q</option></arg>
        </group>
        <group>
          <group>
            <arg><option>--list</option></arg>
            <arg><option>-l</option></arg>
          </group>
          <group>
            <arg><option>--requisites</option></arg>
            <arg><option>-r</option></arg>
          </group>
          <group>
            <arg><option>--expansion</option></arg>
            <arg><option>-e</option></arg>
          </group>
          <group>
            <arg><option>--graph</option></arg>
            <arg><option>-g</option></arg>
          </group>
        </group>
        <arg choice='plain' rep='repeat'><replaceable>args</replaceable></arg>
      </cmdsynopsis>
    </refsect2>

    <refsect2>
      <title>Description</title>
            
      <para>
        The operation <option>--query</option> displays various bits of
        information about Nix expressions or paths in the store.  The queries
        are described in <xref linkend='nixref-queries' />.  At most one query
        can be specified; the default query is <option>--list</option>.
      </para>

    </refsect2>

    <refsect2 id='nixref-queries'>
      <title>Queries</title>
            
      <variablelist>

        <varlistentry>
          <term><option>--list</option></term>
          <listitem>
            <para>
              Prints out the target paths of the Nix expressions indicated by
              the identifiers <replaceable>args</replaceable>.  In the case of
              a derivation expression, these are the paths that will be
              produced by the builder of the expression.  In the case of a
              slice expression, these are the root paths (which are generally
              the paths that were produced by the builder of the derivation
              expression of which the slice is a normal form).
            </para>

            <para>
              This query has one option:
            </para>

            <variablelist>

              <varlistentry>
                <term><option>--normalise</option></term>
                <listitem>
                  <para>
                    Causes the target paths of the <emphasis>normal
                      forms</emphasis> of the expressions to be printed, rather
                    than the target paths of the expressions themselves.
                  </para>
                </listitem>
              </varlistentry>

            </variablelist>
            
          </listitem>
        </varlistentry>

        <varlistentry>
          <term><option>--requisites</option></term>
          <listitem>
            <para>
              Prints out the requisite paths of the Nix 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 Nix 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
              distribution.  A <emphasis>source distribution</emphasis> is
              obtained by distributing the requisite paths of a derivation
              expression.  A <emphasis>binary distribution</emphasis> is
              obtained by distributing the requisite paths of a slice
              expression (i.e., the normal form of a derivation expression; you
              can directly specify the identifier of the slice expression, or
              use <option>--normalise</option> and specify the identifier of a
              derivation expression).  A <emphasis>cache
                distribution</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 distribution, 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>--normalise</option></term>
                <listitem>
                  <para>
                    Causes the requisite paths of the <emphasis>normal
                      forms</emphasis> of the expressions to be printed, rather
                    than the requisite paths of the expressions themselves.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><option>--exclude-exprs</option></term>
                <listitem>
                  <para>
                    Excludes the paths of Nix 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>--expansion</option></term>
          <listitem>
            <para>
              For each identifier in <replaceable>args</replaceable>, prints
              all expansions of that identifier, that is, all paths whose
              current content matches the identifier.
            </para>
          </listitem>
        </varlistentry>

        <varlistentry>
          <term><option>--graph</option></term>
          <listitem>
            <para>
              Prints a graph of the closure of the expressions identified by
              <replaceable>args</replaceable> in the format of the
              <command>dot</command> tool of AT&amp;T's GraphViz package.
            </para>
          </listitem>
        </varlistentry>

      </variablelist>

    </refsect2>

  </refsect1>


</refentry>


<!--
local variables:
sgml-parent-document: ("book.xml" "refentry")
end:
-->