about summary refs log tree commit diff
path: root/doc/manual/nix-instantiate.xml
blob: ec26eaa71379192996d31a5b268eb83c7f763835 (plain) (blame)
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
<refentry>
  <refnamediv>
    <refname>nix-instantiate</refname>
    <refpurpose>instantiate store expressions from Nix expressions</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <cmdsynopsis>
      <command>nix-instantiate</command>
      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
      <group choice='opt'>
        <arg choice='plain'><option>--parse-only</option></arg>
        <arg choice='plain'><option>--eval-only</option></arg>
      </group>
      <arg choice='plain' rep='repeat'><replaceable>files</replaceable></arg>
    </cmdsynopsis>
  </refsynopsisdiv>

  <refsection>
    <title>Description</title>

    <para>
      The command <command>nix-instantiate</command> generates
      (low-level) store expressions from (high-level) Nix expressions.
      It loads and evaluates the Nix expressions in each of
      <replaceable>files</replaceable>.  Each top-level expression
      should evaluate to a derivation, a list of derivations, or a set
      of derivations.  The paths of the resulting store expressions
      are printed on standard output.
    </para>

    <para>
      This command is generally used for testing Nix expression before
      they are used with <command>nix-env</command>.
    </para>

  </refsection>

  <refsection>
    <title>Options</title>

    <variablelist>

      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common.xml#xpointer(/nop/*)" />

      <varlistentry>
        <term><option>--parse-only</option></term>
        <listitem>
          <para>
            Just parse the input files, and print their abstract
            syntax trees on standard output in ATerm format.
          </para>
        </listitem>
      </varlistentry>
      
      <varlistentry>
        <term><option>--eval-only</option></term>
        <listitem>
          <para>
            Just parse and evaluate the input files, and print the
            resulting values on standard output.  No instantiation of
            store expressions takes place.
          </para>
        </listitem>
      </varlistentry>

    </variablelist>

  </refsection>

  <refsection>
    <title>Examples</title>

    <screen>
$ nix-instantiate gcc.nix <lineannotation>(instantiate)</lineannotation>
/nix/store/468abdcb93aa22bb721142615b97698b-d-gcc-3.3.2.store

$ nix-store -r $(nix-instantiate gcc.nix) <lineannotation>(build)</lineannotation>

$ nix-store -r $(nix-instantiate gcc.nix) <lineannotation>(print output path)</lineannotation>
/nix/store/9afa718cddfdfe94b5b9303d0430ceb1-gcc-3.3.2

$ ls -l /nix/store/9afa718cddfdfe94b5b9303d0430ceb1-gcc-3.3.2
dr-xr-xr-x    2 eelco    users         360 2003-12-01 16:12 bin
dr-xr-xr-x    3 eelco    users          72 2003-12-01 16:12 include
...</screen>

  </refsection>
    
</refentry>