1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 10:11:47 +02:00

Get rid of callouts since Markdown doesn't support them

This commit is contained in:
Eelco Dolstra 2020-07-23 13:58:49 +02:00
parent efff6cf163
commit 13df1faf25
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
12 changed files with 233 additions and 251 deletions

View file

@ -6,33 +6,31 @@
<title>Expression Syntax</title>
<example xml:id='ex-hello-nix'><title>Nix expression for GNU Hello
(<filename>default.nix</filename>)</title>
<programlisting>
{ stdenv, fetchurl, perl }: <co xml:id='ex-hello-nix-co-1' />
<para>Here is a Nix expression for GNU Hello:</para>
stdenv.mkDerivation { <co xml:id='ex-hello-nix-co-2' />
name = "hello-2.1.1"; <co xml:id='ex-hello-nix-co-3' />
builder = ./builder.sh; <co xml:id='ex-hello-nix-co-4' />
src = fetchurl { <co xml:id='ex-hello-nix-co-5' />
<programlisting>
{ stdenv, fetchurl, perl }: ①
stdenv.mkDerivation { ②
name = "hello-2.1.1"; ③
builder = ./builder.sh; ④
src = fetchurl { ⑤
url = "ftp://ftp.nluug.nl/pub/gnu/hello/hello-2.1.1.tar.gz";
sha256 = "1md7jsfd8pa45z73bz1kszpp01yw6x5ljkjk2hx7wl800any6465";
};
inherit perl; <co xml:id='ex-hello-nix-co-6' />
inherit perl;
}</programlisting>
</example>
<para><xref linkend='ex-hello-nix' /> shows a Nix expression for GNU
Hello. It's actually already in the Nix Packages collection in
<para>This file is actually already in the Nix Packages collection in
<filename>pkgs/applications/misc/hello/ex-1/default.nix</filename>.
It is customary to place each package in a separate directory and call
the single Nix expression in that directory
<filename>default.nix</filename>. The file has the following elements
(referenced from the figure by number):
<calloutlist>
<orderedlist>
<callout arearefs='ex-hello-nix-co-1'>
<listitem>
<para>This states that the expression is a
<emphasis>function</emphasis> that expects to be called with three
@ -57,9 +55,9 @@ the single Nix expression in that directory
function; when given the required arguments, the body should
describe how to build an instance of the Hello package.</para>
</callout>
</listitem>
<callout arearefs='ex-hello-nix-co-2'>
<listitem>
<para>So we have to build a package. Building something from
other stuff is called a <emphasis>derivation</emphasis> in Nix (as
@ -76,9 +74,9 @@ the single Nix expression in that directory
<replaceable>nameN</replaceable> =
<replaceable>exprN</replaceable>; }</literal>.</para>
</callout>
</listitem>
<callout arearefs='ex-hello-nix-co-3'>
<listitem>
<para>The attribute <varname>name</varname> specifies the symbolic
name and version of the package. Nix doesn't really care about
@ -87,9 +85,9 @@ the single Nix expression in that directory
packages. This attribute is required by
<varname>mkDerivation</varname>.</para>
</callout>
</listitem>
<callout arearefs='ex-hello-nix-co-4'>
<listitem>
<para>The attribute <varname>builder</varname> specifies the
builder. This attribute can sometimes be omitted, in which case
@ -101,9 +99,9 @@ the single Nix expression in that directory
<command>./builder.sh</command> refers to the shell script shown
in <xref linkend='ex-hello-builder' />, discussed below.</para>
</callout>
</listitem>
<callout arearefs='ex-hello-nix-co-5'>
<listitem>
<para>The builder has to know what the sources of the package
are. Here, the attribute <varname>src</varname> is bound to the
@ -120,9 +118,9 @@ the single Nix expression in that directory
customary, and it's also expected by the default builder (which we
don't use in this example).</para>
</callout>
</listitem>
<callout arearefs='ex-hello-nix-co-6'>
<listitem>
<para>Since the derivation requires Perl, we have to pass the
value of the <varname>perl</varname> function argument to the
@ -139,9 +137,9 @@ perl = perl;</programlisting>
causes the specified attributes to be bound to whatever variables
with the same name happen to be in scope.</para>
</callout>
</listitem>
</calloutlist>
</orderedlist>
</para>