Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nora Puchreiner
Nix
Commits
a375326a
Commit
a375326a
authored
8 years ago
by
Eelco Dolstra
Browse files
Options
Downloads
Plain Diff
Merge pull request #884 from srp/fix-nix-build-examples
fix "nix-build" examples
parents
a647c163
96d3534a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/manual/expressions/simple-building-testing.xml
+8
-10
8 additions, 10 deletions
doc/manual/expressions/simple-building-testing.xml
with
8 additions
and
10 deletions
doc/manual/expressions/simple-building-testing.xml
+
8
−
10
View file @
a375326a
...
...
@@ -7,15 +7,14 @@
<title>
Building and Testing
</title>
<para>
You can now try to build Hello. Of course, you could do
<literal>
nix-env -f pkgs/top-level/all-packages.nix -i hello
</literal>
,
but you may not want to install a possibly broken package just yet.
The best way to test the package is by using the command
<command
linkend=
"sec-nix-build"
>
nix-build
</command>
, which builds a Nix
expression and creates a symlink named
<filename>
result
</filename>
in
the current directory:
<literal>
nix-env -i hello
</literal>
, but you may not want to install a
possibly broken package just yet. The best way to test the package is by
using the command
<command
linkend=
"sec-nix-build"
>
nix-build
</command>
,
which builds a Nix expression and creates a symlink named
<filename>
result
</filename>
in the current directory:
<screen>
$ nix-build
pkgs/top-level/all-packages.nix
-A hello
$ nix-build -A hello
building path `/nix/store/632d2b22514d...-hello-2.1.1'
hello-2.1.1/
hello-2.1.1/intl/
...
...
@@ -29,8 +28,7 @@ $ ./result/bin/hello
Hello, world!
</screen>
The
<link
linkend=
'opt-attr'
><option>
-A
</option></link>
option selects
the
<literal>
hello
</literal>
attribute from
<filename>
all-packages.nix
</filename>
. This is faster than using the
the
<literal>
hello
</literal>
attribute. This is faster than using the
symbolic package name specified by the
<literal>
name
</literal>
attribute (which also happens to be
<literal>
hello
</literal>
) and is
unambiguous (there can be multiple packages with the symbolic name
...
...
@@ -69,7 +67,7 @@ block (or perform other derivations if available) until the build
finishes:
<screen>
$ nix-build
pkgs/top-level/all-packages.nix
-A hello
$ nix-build -A hello
waiting for lock on `/nix/store/0h5b7hp8d4hqfrw8igvx97x1xawrjnac-hello-2.1.1x'
</screen>
So it is always safe to run multiple instances of Nix in parallel
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment