@@ -11,147 +11,7 @@
1111 <xi:include href="functions/overrides.xml" />
1212 <xi:include href="functions/generators.xml" />
1313 <xi:include href="functions/debug.xml" />
14− <section xml:id="sec-fhs-environments">
15− <title>buildFHSUserEnv</title>
16−
17− <para>
18− <function>buildFHSUserEnv</function> provides a way to build and run
19− FHS-compatible lightweight sandboxes. It creates an isolated root with bound
20− <filename>/nix/store</filename>, so its footprint in terms of disk space
21− needed is quite small. This allows one to run software which is hard or
22− unfeasible to patch for NixOS -- 3rd-party source trees with FHS
23− assumptions, games distributed as tarballs, software with integrity checking
24− and/or external self-updated binaries. It uses Linux namespaces feature to
25− create temporary lightweight environments which are destroyed after all
26− child processes exit, without root user rights requirement. Accepted
27− arguments are:
28− </para>
29−
30− <variablelist>
31− <varlistentry>
32− <term>
33− <literal>name</literal>
34− </term>
35− <listitem>
36− <para>
37− Environment name.
38− </para>
39− </listitem>
40− </varlistentry>
41− <varlistentry>
42− <term>
43− <literal>targetPkgs</literal>
44− </term>
45− <listitem>
46− <para>
47− Packages to be installed for the main host's architecture (i.e. x86_64 on
48− x86_64 installations). Along with libraries binaries are also installed.
49− </para>
50− </listitem>
51− </varlistentry>
52− <varlistentry>
53− <term>
54− <literal>multiPkgs</literal>
55− </term>
56− <listitem>
57− <para>
58− Packages to be installed for all architectures supported by a host (i.e.
59− i686 and x86_64 on x86_64 installations). Only libraries are installed by
60− default.
61− </para>
62− </listitem>
63− </varlistentry>
64− <varlistentry>
65− <term>
66− <literal>extraBuildCommands</literal>
67− </term>
68− <listitem>
69− <para>
70− Additional commands to be executed for finalizing the directory
71− structure.
72− </para>
73− </listitem>
74− </varlistentry>
75− <varlistentry>
76− <term>
77− <literal>extraBuildCommandsMulti</literal>
78− </term>
79− <listitem>
80− <para>
81− Like <literal>extraBuildCommands</literal>, but executed only on multilib
82− architectures.
83− </para>
84− </listitem>
85− </varlistentry>
86− <varlistentry>
87− <term>
88− <literal>extraOutputsToInstall</literal>
89− </term>
90− <listitem>
91− <para>
92− Additional derivation outputs to be linked for both target and
93− multi-architecture packages.
94− </para>
95− </listitem>
96− </varlistentry>
97− <varlistentry>
98− <term>
99− <literal>extraInstallCommands</literal>
100− </term>
101− <listitem>
102− <para>
103− Additional commands to be executed for finalizing the derivation with
104− runner script.
105− </para>
106− </listitem>
107− </varlistentry>
108− <varlistentry>
109− <term>
110− <literal>runScript</literal>
111− </term>
112− <listitem>
113− <para>
114− A command that would be executed inside the sandbox and passed all the
115− command line arguments. It defaults to <literal>bash</literal>.
116− </para>
117− </listitem>
118− </varlistentry>
119− </variablelist>
120−
121− <para>
122− One can create a simple environment using a <literal>shell.nix</literal>
123− like that:
124− </para>
125−
126−<programlisting><![CDATA[
127−{ pkgs ? import <nixpkgs> {} }:
128−
129−(pkgs.buildFHSUserEnv {
130− name = "simple-x11-env";
131− targetPkgs = pkgs: (with pkgs;
132− [ udev
133− alsaLib
134− ]) ++ (with pkgs.xorg;
135− [ libX11
136− libXcursor
137− libXrandr
138− ]);
139− multiPkgs = pkgs: (with pkgs;
140− [ udev
141− alsaLib
142− ]);
143− runScript = "bash";
144−}).env
145−]]></programlisting>
146−
147− <para>
148− Running <literal>nix-shell</literal> would then drop you into a shell with
149− these libraries and binaries available. You can use this to run
150− closed-source applications which expect FHS structure without hassles:
151− simply change <literal>runScript</literal> to the application path, e.g.
152− <filename>./bin/start.sh</filename> -- relative paths are supported.
153− </para>
154− </section>
14+ <xi:include href="functions/fhs-environments.xml" />
15515 <xi:include href="shell.section.xml" />
15616 <section xml:id="sec-pkgs-dockerTools">
15717 <title>pkgs.dockerTools</title>