about summary refs log tree commit diff
path: root/doc/manual/book.xml
blob: f08ffc3b0631496b76214b09ae92ea53ab3c0767 (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
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
<?xml version="1.0"?>
<!DOCTYPE book SYSTEM "/nix/current/xml/dtd/docbook/docbookx.dtd"
[
]>

<book>
  <title>Nix: The Manual</title>


  <!--======================================================================-->

  <chapter>
    <title>Introduction</title>

    <sect1>
      <title>The problem space</title>

      <para>
	Nix is a system for controlling the automatic creation and distribution
	of data, such as computer programs and other software artifacts.  This
	is a very general problem, and there are many applications that fall
	under this description.
      </para>

      <sect2>
	<title>Build management</title>

	<para>
	  Build management tools are used to perform <emphasis>software
	    builds</emphasis>, that is, the construction of derived products
	  such as executable programs from source code.  A commonly used build
	  tool is Make, which is a standard tool on Unix systems. These tools
	  have to deal with several issues:
	  <itemizedlist>
	    <listitem>
	      <para>
	      </para>
	    </listitem>
	  </itemizedlist>
	</para>

      </sect2>

      <sect2>
	<title>Package management</title>

	<para>
	  After software has been built, is must also be
	  <emphasis>deployed</emphasis> in the intended target environment,
	  e.g., the user's workstation.  Examples include the Red Hat package
	  manager (RPM), Microsoft's MSI, and so on.  Here also we have to deal
	  with several issues:
	  <itemizedlist>
	    <listitem>
	      <para>
		The <emphasis>creation</emphasis> of packages from some formal
		description of what artifacts should be distributed in the
		package.
	      </para>
	    </listitem>
	    <listitem>
	      <para>
		The <emphasis>deployment</emphasis> of packages, that is, the
		mechanism by which we get them onto the intended target
		environment.  This can be as simple as copying a file, but
		complexity comes from the wide range of possible installation
		media (such as a network install), and the scalability of the
		process (if a program must be installed on a thousand systems,
		we do not want to visit each system and perform some manual
		steps to install the program on that system; that is, the
		complexity for the system administrator should be constant, not
		linear).
	      </para>
	    </listitem>
	  </itemizedlist>
	</para>
      </sect2>

    </sect1>

    <sect1>
      <title>The Nix system</title>

      <para>
	...
      </para>

      <para>
	Existing tools in this field generally both a underlying model (such as
	the derivation graph of build tools, or the versioning scheme that
	determines when two packages are <quote>compatible</quote> in a package
	management system) and a formalism that allows ...
      </para>

      <para>
	Following the principle of separation of mechanism and policy, the Nix
	system separates the <emphasis>low-level aspect</emphasis> of file
	system object management form the <emphasis>high-level
	  aspect</emphasis> of the ...
      </para>

    </sect1>

  </chapter>


  <!--======================================================================-->

  <chapter>
    <title>A Guided Tour</title>

    <para>
      Bla bla
    </para>
  </chapter>


  <!--======================================================================-->

  <chapter>
    <title>Fix Language Reference</title>

    <para>
      Bla bla
    </para>
  </chapter>


  <!--======================================================================-->

  <chapter>
    <title>Nix Syntax and Semantics</title>

    <para>
      Bla bla
    </para>
  </chapter>


  <!--======================================================================-->

  <chapter>
    <title>Installation</title>

    <sect1>
      <title>Prerequisites</title>

      <para>
	Nix uses Sleepycat's Berkeley DB and CWI's ATerm library.  However,
	these are fetched automatically as part of the build process.
      </para>

      <para>
	Other than that, you need a good C++ compiler.  GCC 2.95 does not
	appear to work; please use GCC 3.x.
      </para>
    </sect1>

    <sect1>
      <title>Obtaining Nix</title>

      <para>
	Nix can be obtained from its <ulink
	  url='http://losser.st-lab.cs.uu.nl:12080/repos/trace/nix/trunk'>Subversion 
	  repository</ulink>.  For example, the following command will check
	out the latest revision into a directory called
	<filename>nix</filename>:
      </para>

      <screen>
$ svn checkout http://losser.st-lab.cs.uu.nl:12080/repos/trace/nix/trunk nix</screen>

      <para>
	Likewise, specific releases can be obtained from the <ulink
	  url='http://losser.st-lab.cs.uu.nl:12080/repos/trace/nix/tags'>tags
	  directory</ulink> of the repository.  If you don't have Subversion,
	you can download a <ulink
	  url='http://losser.st-lab.cs.uu.nl:12080/dist/trace/'>compressed
	  tar-file</ulink> of the latest revision of the repository.
      </para>

    </sect1>

    <sect1>
      <title>Building Nix</title>

      <para>
	To build Nix, do the following:
      </para>

      <screen>
$ autoreconf -i
$ ./configure <replaceable>options...</replaceable>
$ make
$ make install</screen>

      <para>
	Currently, the only useful switch for <command>configure</command> is
	<option>--prefix=<replaceable>prefix</replaceable></option> to specify
	where Nix is to be installed.  The default installation directory is
	<filename>/nix</filename>.  You can change this to any location you
	like.  You should ensure that you have write permission to the
	installation prefix. 
      </para>

      <warning>
	<para>
	  It is advisable <emphasis>not</emphasis> to change the installation
	  prefix, since doing so will in all likelihood make it impossible to
	  use derivates built on other systems.
	</para>
      </warning>

    </sect1>

  </chapter>


  <!--======================================================================-->

  <appendix>
    <title>Command Reference</title>

    <refentry>
      <refnamediv>
	<refname>nix</refname>
	<refpurpose>manipulate or query the Nix store</refpurpose>
      </refnamediv>

      <refsynopsisdiv>
	<cmdsynopsis>
	  <command>nix</command>
	  <arg>--verbose</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>
      </refsect1>

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

	<para>
	  <command>nix</command> has many subcommands.  These are listed below.
	  In this section the common options are listed.  These options are
	  allowed for every subcommand (although they may not always have an
	  effect).
	</para>
      </refsect1>

      <refsect1>
	<title>Subcommand <command>--install</command></title>

	<refsect2>
	  <title>Synopsis</title>
	  <cmdsynopsis>
	    <command>nix --install</command>
	    <arg rep='repeat'><replaceable>id</replaceable></arg>
	  </cmdsynopsis>
	</refsect2>

	<refsect2>
	  <title>Description</title>
	    
	  <para>
	    <command>nix --install</command> realises the given Nix expressions
	    in the file system.
	  </para>
	</refsect2>
      </refsect1>

    </refentry>

  </appendix>


  <!--======================================================================-->

  <appendix>
    <title>Troubleshooting</title>

    <sect1>
      <title>Database hangs</title>

      <para>
	If Nix or Fix appear to hang immediately after they are started, Nix's
	database is probably <quote>wedged</quote>, i.e., some process died
	while it held a lock on the database.  The solution is to ensure that
	no other processes are accessing the database and then run the
	following command:
      </para>

      <screen>
$ db_recover -e -h <replaceable>prefix</replaceable>/var/nix/db</screen>

      <para>
	Here, <replaceable>prefix</replaceable> should be replaced by Nix's
	installation prefix.
      </para>

    </sect1>


    <sect1>
      <title>Database logfile removal</title>

      <para>
	Every time a Nix database transaction takes place, Nix writes a record
	of this transaction to a <emphasis>log</emphasis> in its database
	directory to ensure that the operation can be replayed in case of a
	application or system crash.  However, without manual intervention,
	the log grows indefinitely.  Hence, unused log files should be deleted
	periodically.  This can be accomplished using the following command:
      </para>

      <screen>
$ rm `db_archive -a -h <replaceable>prefix</replaceable>/var/nix/db`</screen>

    </sect1>
	

  </appendix>


  <!--======================================================================-->

  <appendix>
    <title>Bugs</title>

    <itemizedlist>

      <listitem>
	<para>
	  Nix should automatically recover the Berkeley DB database.
	</para>
      </listitem>

      <listitem>
	<para>
	  Nix should automatically remove Berkeley DB logfiles.
	</para>
      </listitem>

    </itemizedlist>
  </appendix>

</book>