Skip to content

Commit 6f3aeea

Browse files
committed
Show an example default.nix that calls hello.nix
1 parent cd74a55 commit 6f3aeea

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

doc/manual/expressions/arguments-variables.xml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,23 @@ hello = callPackage ../applications/misc/hello/ex-1 { };
105105
hello = callPackage ../applications/misc/hello/ex-1 { stdenv = myStdenv; };
106106
</programlisting>
107107

108-
</para></note>
108+
</para>
109+
110+
<para>A useful way to use the callPackage function would be to
111+
change the name of the above <filename>default.nix</filename>
112+
to <filename>hello.nix</filename> and create a new
113+
<filename>default.nix</filename> as follows:</para>
114+
115+
<programlisting>
116+
(import <nixpkgs> {}).callPackage ./hello.nix {}
117+
</programlisting>
118+
119+
<para>This infrastructure allows you to build it as a local
120+
package simply by running <literal>nix-build</literal> or drop
121+
into a build environment shell with
122+
<literal>nix-shell</literal></para>
123+
124+
</note>
109125

110126
</callout>
111127

@@ -118,4 +134,4 @@ hello = callPackage ../applications/misc/hello/ex-1 { stdenv = myStdenv; };
118134

119135
</calloutlist>
120136

121-
</section>
137+
</section>

0 commit comments

Comments
 (0)