1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-09 03:43:54 +02:00

Get rid of <example>

Markdown doesn't have floats so we can't have this.
This commit is contained in:
Eelco Dolstra 2020-07-23 14:10:59 +02:00
parent 13df1faf25
commit ca130b73a0
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
6 changed files with 156 additions and 134 deletions

View file

@ -434,88 +434,93 @@ stdenv.mkDerivation { … }
</varlistentry>
</variablelist>
<example>
<title>Fetching a private repository over SSH</title>
<programlisting>builtins.fetchGit {
<para>Here are some examples of how to use
<literal>fetchGit</literal>.</para>
<itemizedlist>
<listitem>
<para>To fetch a private repository over SSH:</para>
<programlisting>builtins.fetchGit {
url = "git@github.com:my-secret/repository.git";
ref = "master";
rev = "adab8b916a45068c044658c4158d81878f9ed1c3";
}</programlisting>
</example>
<example>
<title>Fetching an arbitrary ref</title>
<programlisting>builtins.fetchGit {
</listitem>
<listitem>
<para>To fetch an arbitrary reference:</para>
<programlisting>builtins.fetchGit {
url = "https://github.com/NixOS/nix.git";
ref = "refs/heads/0.5-release";
}</programlisting>
</example>
</listitem>
<example>
<title>Fetching a repository's specific commit on an arbitrary branch</title>
<para>
If the revision you're looking for is in the default branch
of the git repository you don't strictly need to specify
the branch name in the <varname>ref</varname> attribute.
</para>
<para>
However, if the revision you're looking for is in a future
branch for the non-default branch you will need to specify
the the <varname>ref</varname> attribute as well.
</para>
<programlisting>builtins.fetchGit {
<listitem>
<para>
If the revision you're looking for is in the default branch
of the git repository you don't strictly need to specify
the branch name in the <varname>ref</varname> attribute.
</para>
<para>
However, if the revision you're looking for is in a future
branch for the non-default branch you will need to specify
the the <varname>ref</varname> attribute as well.
</para>
<programlisting>builtins.fetchGit {
url = "https://github.com/nixos/nix.git";
rev = "841fcbd04755c7a2865c51c1e2d3b045976b7452";
ref = "1.11-maintenance";
}</programlisting>
<note>
<para>
It is nice to always specify the branch which a revision
belongs to. Without the branch being specified, the
fetcher might fail if the default branch changes.
Additionally, it can be confusing to try a commit from a
non-default branch and see the fetch fail. If the branch
is specified the fault is much more obvious.
</para>
</note>
</example>
<example>
<title>Fetching a repository's specific commit on the default branch</title>
<para>
If the revision you're looking for is in the default branch
of the git repository you may omit the
<varname>ref</varname> attribute.
</para>
<programlisting>builtins.fetchGit {
<note>
<para>
It is nice to always specify the branch which a revision
belongs to. Without the branch being specified, the
fetcher might fail if the default branch changes.
Additionally, it can be confusing to try a commit from a
non-default branch and see the fetch fail. If the branch
is specified the fault is much more obvious.
</para>
</note>
</listitem>
<listitem>
<para>
If the revision you're looking for is in the default branch
of the git repository you may omit the
<varname>ref</varname> attribute.
</para>
<programlisting>builtins.fetchGit {
url = "https://github.com/nixos/nix.git";
rev = "841fcbd04755c7a2865c51c1e2d3b045976b7452";
}</programlisting>
</example>
</listitem>
<example>
<title>Fetching a tag</title>
<programlisting>builtins.fetchGit {
<listitem>
<para>To fetch a specific tag:</para>
<programlisting>builtins.fetchGit {
url = "https://github.com/nixos/nix.git";
ref = "refs/tags/1.9";
}</programlisting>
</example>
</listitem>
<example>
<title>Fetching the latest version of a remote branch</title>
<para>
<function>builtins.fetchGit</function> can behave impurely
fetch the latest version of a remote branch.
</para>
<note><para>Nix will refetch the branch in accordance to
<xref linkend="conf-tarball-ttl" />.</para></note>
<note><para>This behavior is disabled in
<emphasis>Pure evaluation mode</emphasis>.</para></note>
<listitem>
<para>To fetch the latest version of a remote branch:</para>
<programlisting>builtins.fetchGit {
url = "ssh://git@github.com/nixos/nix.git";
ref = "master";
}</programlisting>
</example>
<note><para>Nix will refetch the branch in accordance to
<xref linkend="conf-tarball-ttl" />.</para></note>
<note><para>This behavior is disabled in <emphasis>Pure
evaluation mode</emphasis>.</para></note>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>