Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fc4acd9dd | ||
|
|
f2d9b07b3c |
No files matched your search
-262
@@ -1,262 +0,0 @@
|
|||||||
# START "git svn show-ignore"
|
|
||||||
|
|
||||||
# /
|
|
||||||
/Makefile
|
|
||||||
/Makefile.in
|
|
||||||
/aclocal.m4
|
|
||||||
/autom4te.cache
|
|
||||||
/config.*
|
|
||||||
/configure
|
|
||||||
/nix.spec
|
|
||||||
/stamp-h1
|
|
||||||
/svn-revision
|
|
||||||
/NEWS
|
|
||||||
/libtool
|
|
||||||
|
|
||||||
# /config/
|
|
||||||
/config/config.guess
|
|
||||||
/config/config.sub
|
|
||||||
/config/depcomp
|
|
||||||
/config/install-sh
|
|
||||||
/config/missing
|
|
||||||
/config/mkinstalldirs
|
|
||||||
/config/ltmain.sh
|
|
||||||
|
|
||||||
# /corepkgs/
|
|
||||||
/corepkgs/Makefile
|
|
||||||
/corepkgs/Makefile.in
|
|
||||||
|
|
||||||
# /corepkgs/buildenv/
|
|
||||||
/corepkgs/buildenv/Makefile.in
|
|
||||||
/corepkgs/buildenv/Makefile
|
|
||||||
/corepkgs/buildenv/builder.pl
|
|
||||||
|
|
||||||
# /corepkgs/channels/
|
|
||||||
/corepkgs/channels/Makefile.in
|
|
||||||
/corepkgs/channels/Makefile
|
|
||||||
/corepkgs/channels/unpack.sh
|
|
||||||
|
|
||||||
# /corepkgs/nar/
|
|
||||||
/corepkgs/nar/Makefile
|
|
||||||
/corepkgs/nar/Makefile.in
|
|
||||||
/corepkgs/nar/nar.sh
|
|
||||||
/corepkgs/nar/unnar.sh
|
|
||||||
|
|
||||||
# /doc/
|
|
||||||
/doc/Makefile
|
|
||||||
/doc/Makefile.in
|
|
||||||
|
|
||||||
# /doc/manual/
|
|
||||||
/doc/manual/Makefile
|
|
||||||
/doc/manual/Makefile.in
|
|
||||||
/doc/manual/manual.html
|
|
||||||
/doc/manual/manual.is-valid
|
|
||||||
/doc/manual/*.1
|
|
||||||
/doc/manual/*.8
|
|
||||||
/doc/manual/images
|
|
||||||
/doc/manual/version.txt
|
|
||||||
/doc/manual/NEWS.html
|
|
||||||
/doc/manual/NEWS.txt
|
|
||||||
|
|
||||||
# /externals/
|
|
||||||
/externals/Makefile
|
|
||||||
/externals/Makefile.in
|
|
||||||
/externals/aterm-*
|
|
||||||
/externals/have-aterm
|
|
||||||
/externals/build-aterm
|
|
||||||
/externals/inst-aterm
|
|
||||||
/externals/bzip2-*
|
|
||||||
/externals/have-bzip2
|
|
||||||
/externals/build-bzip2
|
|
||||||
/externals/inst-bzip2
|
|
||||||
|
|
||||||
# /make/examples/aterm/
|
|
||||||
/make/examples/aterm/result*
|
|
||||||
|
|
||||||
# /make/examples/aterm/aterm/
|
|
||||||
/make/examples/aterm/aterm/*
|
|
||||||
|
|
||||||
# /make/examples/aterm/test/
|
|
||||||
/make/examples/aterm/test/*
|
|
||||||
|
|
||||||
# /misc/
|
|
||||||
/misc/Makefile.in
|
|
||||||
/misc/Makefile
|
|
||||||
|
|
||||||
# /misc/emacs/
|
|
||||||
/misc/emacs/Makefile.in
|
|
||||||
/misc/emacs/Makefile
|
|
||||||
|
|
||||||
# /scripts/
|
|
||||||
/scripts/Makefile
|
|
||||||
/scripts/Makefile.in
|
|
||||||
/scripts/nix-profile.sh
|
|
||||||
/scripts/nix-pull
|
|
||||||
/scripts/nix-push
|
|
||||||
/scripts/nix-switch
|
|
||||||
/scripts/nix-collect-garbage
|
|
||||||
/scripts/nix-prefetch-url
|
|
||||||
/scripts/nix-install-package
|
|
||||||
/scripts/nix-channel
|
|
||||||
/scripts/nix-build
|
|
||||||
/scripts/nix-copy-closure
|
|
||||||
/scripts/readmanifest.pm
|
|
||||||
/scripts/readconfig.pm
|
|
||||||
/scripts/download-using-manifests.pl
|
|
||||||
/scripts/copy-from-other-stores.pl
|
|
||||||
/scripts/generate-patches.pl
|
|
||||||
/scripts/find-runtime-roots.pl
|
|
||||||
/scripts/build-remote.pl
|
|
||||||
|
|
||||||
# /src/
|
|
||||||
/src/Makefile
|
|
||||||
/src/Makefile.in
|
|
||||||
|
|
||||||
# /src/bin2c/
|
|
||||||
/src/bin2c/Makefile.in
|
|
||||||
/src/bin2c/Makefile
|
|
||||||
/src/bin2c/bin2c
|
|
||||||
/src/bin2c/.deps
|
|
||||||
/src/bin2c/.libs
|
|
||||||
|
|
||||||
# /src/boost/
|
|
||||||
/src/boost/Makefile
|
|
||||||
/src/boost/Makefile.in
|
|
||||||
|
|
||||||
# /src/boost/format/
|
|
||||||
/src/boost/format/Makefile
|
|
||||||
/src/boost/format/Makefile.in
|
|
||||||
/src/boost/format/.deps
|
|
||||||
/src/boost/format/libformat.a
|
|
||||||
/src/boost/format/.libs
|
|
||||||
|
|
||||||
# /src/bsdiff-4.3/
|
|
||||||
/src/bsdiff-4.3/Makefile
|
|
||||||
/src/bsdiff-4.3/Makefile.in
|
|
||||||
/src/bsdiff-4.3/bsdiff
|
|
||||||
/src/bsdiff-4.3/bspatch
|
|
||||||
/src/bsdiff-4.3/.deps
|
|
||||||
/src/bsdiff-4.3/.libs
|
|
||||||
|
|
||||||
# /src/libexpr/
|
|
||||||
/src/libexpr/Makefile
|
|
||||||
/src/libexpr/Makefile.in
|
|
||||||
/src/libexpr/.deps
|
|
||||||
/src/libexpr/libexpr.a
|
|
||||||
/src/libexpr/lexer-tab.cc
|
|
||||||
/src/libexpr/lexer-tab.hh
|
|
||||||
/src/libexpr/parser-tab.cc
|
|
||||||
/src/libexpr/parser-tab.hh
|
|
||||||
/src/libexpr/parser-tab.output
|
|
||||||
/src/libexpr/nixexpr-ast.hh
|
|
||||||
/src/libexpr/nixexpr-ast.cc
|
|
||||||
/src/libexpr/.libs
|
|
||||||
/src/libexpr/nix.tbl
|
|
||||||
|
|
||||||
# /src/libmain/
|
|
||||||
/src/libmain/Makefile
|
|
||||||
/src/libmain/Makefile.in
|
|
||||||
/src/libmain/.deps
|
|
||||||
/src/libmain/libmain.a
|
|
||||||
/src/libmain/.libs
|
|
||||||
|
|
||||||
# /src/libstore/
|
|
||||||
/src/libstore/Makefile
|
|
||||||
/src/libstore/Makefile.in
|
|
||||||
/src/libstore/.deps
|
|
||||||
/src/libstore/libstore.a
|
|
||||||
/src/libstore/derivations-ast.cc
|
|
||||||
/src/libstore/derivations-ast.hh
|
|
||||||
/src/libstore/.libs
|
|
||||||
|
|
||||||
# /src/libutil/
|
|
||||||
/src/libutil/Makefile
|
|
||||||
/src/libutil/Makefile.in
|
|
||||||
/src/libutil/.deps
|
|
||||||
/src/libutil/libutil.a
|
|
||||||
/src/libutil/.libs
|
|
||||||
|
|
||||||
# /src/nix-env/
|
|
||||||
/src/nix-env/Makefile.in
|
|
||||||
/src/nix-env/Makefile
|
|
||||||
/src/nix-env/.deps
|
|
||||||
/src/nix-env/nix-env
|
|
||||||
/src/nix-env/help.txt.hh
|
|
||||||
/src/nix-env/.libs
|
|
||||||
|
|
||||||
# /src/nix-hash/
|
|
||||||
/src/nix-hash/Makefile
|
|
||||||
/src/nix-hash/Makefile.in
|
|
||||||
/src/nix-hash/.deps
|
|
||||||
/src/nix-hash/.libs
|
|
||||||
/src/nix-hash/nix-hash
|
|
||||||
/src/nix-hash/help.txt.hh
|
|
||||||
|
|
||||||
# /src/nix-instantiate/
|
|
||||||
/src/nix-instantiate/Makefile.in
|
|
||||||
/src/nix-instantiate/Makefile
|
|
||||||
/src/nix-instantiate/.deps
|
|
||||||
/src/nix-instantiate/nix-instantiate
|
|
||||||
/src/nix-instantiate/help.txt.hh
|
|
||||||
/src/nix-instantiate/.libs
|
|
||||||
|
|
||||||
# /src/nix-log2xml/
|
|
||||||
/src/nix-log2xml/Makefile.in
|
|
||||||
/src/nix-log2xml/Makefile
|
|
||||||
/src/nix-log2xml/.deps
|
|
||||||
/src/nix-log2xml/nix-log2xml
|
|
||||||
/src/nix-log2xml/test*.*
|
|
||||||
/src/nix-log2xml/.libs
|
|
||||||
/src/nix-log2xml/*.log
|
|
||||||
/src/nix-log2xml/*.xml
|
|
||||||
/src/nix-log2xml/*.html
|
|
||||||
|
|
||||||
# /src/nix-setuid-helper/
|
|
||||||
/src/nix-setuid-helper/Makefile.in
|
|
||||||
/src/nix-setuid-helper/Makefile
|
|
||||||
/src/nix-setuid-helper/.deps
|
|
||||||
/src/nix-setuid-helper/nix-setuid-helper
|
|
||||||
/src/nix-setuid-helper/help.txt.hh
|
|
||||||
/src/nix-setuid-helper/.libs
|
|
||||||
|
|
||||||
# /src/nix-store/
|
|
||||||
/src/nix-store/Makefile
|
|
||||||
/src/nix-store/Makefile.in
|
|
||||||
/src/nix-store/.deps
|
|
||||||
/src/nix-store/help.txt.hh
|
|
||||||
/src/nix-store/nix-store
|
|
||||||
/src/nix-store/.libs
|
|
||||||
|
|
||||||
# /src/nix-worker/
|
|
||||||
/src/nix-worker/Makefile.in
|
|
||||||
/src/nix-worker/Makefile
|
|
||||||
/src/nix-worker/.deps
|
|
||||||
/src/nix-worker/nix-worker
|
|
||||||
/src/nix-worker/help.txt.hh
|
|
||||||
/src/nix-worker/.libs
|
|
||||||
|
|
||||||
# /tests/
|
|
||||||
/tests/Makefile
|
|
||||||
/tests/Makefile.in
|
|
||||||
/tests/test-tmp
|
|
||||||
/tests/config.nix
|
|
||||||
/tests/common.sh
|
|
||||||
/tests/dummy
|
|
||||||
|
|
||||||
# /tests/lang/
|
|
||||||
/tests/lang/*.out
|
|
||||||
/tests/lang/*.out.xml
|
|
||||||
/tests/lang/*.ast
|
|
||||||
|
|
||||||
# END "git svn show-ignore"
|
|
||||||
|
|
||||||
*.lo
|
|
||||||
*.la
|
|
||||||
*.o
|
|
||||||
*~
|
|
||||||
|
|
||||||
# GNU Global
|
|
||||||
GPATH
|
|
||||||
GRTAGS
|
|
||||||
GSYMS
|
|
||||||
GTAGS
|
|
||||||
@@ -1,397 +1,221 @@
|
|||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 2.1, February 1999
|
Version 2, June 1991
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
[This is the first released version of the Lesser GPL. It also counts
|
|
||||||
as the successor of the GNU Library Public License, version 2, hence
|
|
||||||
the version number 2.1.]
|
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
The licenses for most software are designed to take away your
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
Licenses are intended to guarantee your freedom to share and change
|
License is intended to guarantee your freedom to share and change free
|
||||||
free software--to make sure the software is free for all its users.
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
This license, the Lesser General Public License, applies to some
|
When we speak of free software, we are referring to freedom, not
|
||||||
specially designated software packages--typically libraries--of the
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
Free Software Foundation and other authors who decide to use it. You
|
have the freedom to distribute copies of free software (and charge for
|
||||||
can use it too, but we suggest you first think carefully about whether
|
this service if you wish), that you receive source code or can get it
|
||||||
this license or the ordinary General Public License is the better
|
if you want it, that you can change the software or use pieces of it
|
||||||
strategy to use in any particular case, based on the explanations below.
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom of use,
|
|
||||||
not price. Our General Public Licenses are designed to make sure that
|
|
||||||
you have the freedom to distribute copies of free software (and charge
|
|
||||||
for this service if you wish); that you receive source code or can get
|
|
||||||
it if you want it; that you can change the software and use pieces of
|
|
||||||
it in new free programs; and that you are informed that you can do
|
|
||||||
these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
To protect your rights, we need to make restrictions that forbid
|
||||||
distributors to deny you these rights or to ask you to surrender these
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
rights. These restrictions translate to certain responsibilities for
|
These restrictions translate to certain responsibilities for you if you
|
||||||
you if you distribute copies of the library or if you modify it.
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
For example, if you distribute copies of the library, whether gratis
|
For example, if you distribute copies of such a program, whether
|
||||||
or for a fee, you must give the recipients all the rights that we gave
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
you. You must make sure that they, too, receive or can get the source
|
you have. You must make sure that they, too, receive or can get the
|
||||||
code. If you link other code with the library, you must provide
|
source code. And you must show them these terms so they know their
|
||||||
complete object files to the recipients, so that they can relink them
|
rights.
|
||||||
with the library after making changes to the library and recompiling
|
|
||||||
it. And you must show them these terms so they know their rights.
|
|
||||||
|
|
||||||
We protect your rights with a two-step method: (1) we copyright the
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
library, and (2) we offer you this license, which gives you legal
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
permission to copy, distribute and/or modify the library.
|
distribute and/or modify the software.
|
||||||
|
|
||||||
To protect each distributor, we want to make it very clear that
|
Also, for each author's protection and ours, we want to make certain
|
||||||
there is no warranty for the free library. Also, if the library is
|
that everyone understands that there is no warranty for this free
|
||||||
modified by someone else and passed on, the recipients should know
|
software. If the software is modified by someone else and passed on, we
|
||||||
that what they have is not the original version, so that the original
|
want its recipients to know that what they have is not the original, so
|
||||||
author's reputation will not be affected by problems that might be
|
that any problems introduced by others will not reflect on the original
|
||||||
introduced by others.
|
authors' reputations.
|
||||||
|
|
||||||
Finally, software patents pose a constant threat to the existence of
|
|
||||||
any free program. We wish to make sure that a company cannot
|
|
||||||
effectively restrict the users of a free program by obtaining a
|
|
||||||
restrictive license from a patent holder. Therefore, we insist that
|
|
||||||
any patent license obtained for a version of the library must be
|
|
||||||
consistent with the full freedom of use specified in this license.
|
|
||||||
|
|
||||||
Most GNU software, including some libraries, is covered by the
|
Finally, any free program is threatened constantly by software
|
||||||
ordinary GNU General Public License. This license, the GNU Lesser
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
General Public License, applies to certain designated libraries, and
|
program will individually obtain patent licenses, in effect making the
|
||||||
is quite different from the ordinary General Public License. We use
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
this license for certain libraries in order to permit linking those
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
libraries into non-free programs.
|
|
||||||
|
|
||||||
When a program is linked with a library, whether statically or using
|
|
||||||
a shared library, the combination of the two is legally speaking a
|
|
||||||
combined work, a derivative of the original library. The ordinary
|
|
||||||
General Public License therefore permits such linking only if the
|
|
||||||
entire combination fits its criteria of freedom. The Lesser General
|
|
||||||
Public License permits more lax criteria for linking other code with
|
|
||||||
the library.
|
|
||||||
|
|
||||||
We call this license the "Lesser" General Public License because it
|
|
||||||
does Less to protect the user's freedom than the ordinary General
|
|
||||||
Public License. It also provides other free software developers Less
|
|
||||||
of an advantage over competing non-free programs. These disadvantages
|
|
||||||
are the reason we use the ordinary General Public License for many
|
|
||||||
libraries. However, the Lesser license provides advantages in certain
|
|
||||||
special circumstances.
|
|
||||||
|
|
||||||
For example, on rare occasions, there may be a special need to
|
|
||||||
encourage the widest possible use of a certain library, so that it becomes
|
|
||||||
a de-facto standard. To achieve this, non-free programs must be
|
|
||||||
allowed to use the library. A more frequent case is that a free
|
|
||||||
library does the same job as widely used non-free libraries. In this
|
|
||||||
case, there is little to gain by limiting the free library to free
|
|
||||||
software only, so we use the Lesser General Public License.
|
|
||||||
|
|
||||||
In other cases, permission to use a particular library in non-free
|
|
||||||
programs enables a greater number of people to use a large body of
|
|
||||||
free software. For example, permission to use the GNU C Library in
|
|
||||||
non-free programs enables many more people to use the whole GNU
|
|
||||||
operating system, as well as its variant, the GNU/Linux operating
|
|
||||||
system.
|
|
||||||
|
|
||||||
Although the Lesser General Public License is Less protective of the
|
|
||||||
users' freedom, it does ensure that the user of a program that is
|
|
||||||
linked with the Library has the freedom and the wherewithal to run
|
|
||||||
that program using a modified version of the Library.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow. Pay close attention to the difference between a
|
modification follow.
|
||||||
"work based on the library" and a "work that uses the library". The
|
|
||||||
former contains code derived from the library, whereas the latter must
|
|
||||||
be combined with the library in order to run.
|
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
0. This License Agreement applies to any software library or other
|
0. This License applies to any program or other work which contains
|
||||||
program which contains a notice placed by the copyright holder or
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
other authorized party saying it may be distributed under the terms of
|
under the terms of this General Public License. The "Program", below,
|
||||||
this Lesser General Public License (also called "this License").
|
refers to any such program or work, and a "work based on the Program"
|
||||||
Each licensee is addressed as "you".
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
A "library" means a collection of software functions and/or data
|
Activities other than copying, distribution and modification are not
|
||||||
prepared so as to be conveniently linked with application programs
|
|
||||||
(which use some of those functions and data) to form executables.
|
|
||||||
|
|
||||||
The "Library", below, refers to any such software library or work
|
|
||||||
which has been distributed under these terms. A "work based on the
|
|
||||||
Library" means either the Library or any derivative work under
|
|
||||||
copyright law: that is to say, a work containing the Library or a
|
|
||||||
portion of it, either verbatim or with modifications and/or translated
|
|
||||||
straightforwardly into another language. (Hereinafter, translation is
|
|
||||||
included without limitation in the term "modification".)
|
|
||||||
|
|
||||||
"Source code" for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For a library, complete source code means
|
|
||||||
all the source code for all modules it contains, plus any associated
|
|
||||||
interface definition files, plus the scripts used to control compilation
|
|
||||||
and installation of the library.
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
covered by this License; they are outside its scope. The act of
|
||||||
running a program using the Library is not restricted, and output from
|
running the Program is not restricted, and the output from the Program
|
||||||
such a program is covered only if its contents constitute a work based
|
is covered only if its contents constitute a work based on the
|
||||||
on the Library (independent of the use of the Library in a tool for
|
Program (independent of having been made by running the Program).
|
||||||
writing it). Whether that is true depends on what the Library does
|
Whether that is true depends on what the Program does.
|
||||||
and what the program that uses the Library does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Library's
|
|
||||||
complete source code as you receive it, in any medium, provided that
|
|
||||||
you conspicuously and appropriately publish on each copy an
|
|
||||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
|
||||||
all the notices that refer to this License and to the absence of any
|
|
||||||
warranty; and distribute a copy of this License along with the
|
|
||||||
Library.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy,
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
and you may at your option offer warranty protection in exchange for a
|
source code as you receive it, in any medium, provided that you
|
||||||
fee.
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
2. You may modify your copy or copies of the Library or any portion
|
notices that refer to this License and to the absence of any warranty;
|
||||||
of it, thus forming a work based on the Library, and copy and
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
distribute such modifications or work under the terms of Section 1
|
distribute such modifications or work under the terms of Section 1
|
||||||
above, provided that you also meet all of these conditions:
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
a) The modified work must itself be a software library.
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
|
||||||
b) You must cause the files modified to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
c) You must cause the whole of the work to be licensed at no
|
b) You must cause any work that you distribute or publish, that in
|
||||||
charge to all third parties under the terms of this License.
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
d) If a facility in the modified Library refers to a function or a
|
parties under the terms of this License.
|
||||||
table of data to be supplied by an application program that uses
|
|
||||||
the facility, other than as an argument passed when the facility
|
|
||||||
is invoked, then you must make a good faith effort to ensure that,
|
|
||||||
in the event an application does not supply such function or
|
|
||||||
table, the facility still operates, and performs whatever part of
|
|
||||||
its purpose remains meaningful.
|
|
||||||
|
|
||||||
(For example, a function in a library to compute square roots has
|
|
||||||
a purpose that is entirely well-defined independent of the
|
|
||||||
application. Therefore, Subsection 2d requires that any
|
|
||||||
application-supplied function or table used by this function must
|
|
||||||
be optional: if the application does not supply it, the square
|
|
||||||
root function must still compute square roots.)
|
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
These requirements apply to the modified work as a whole. If
|
||||||
identifiable sections of that work are not derived from the Library,
|
identifiable sections of that work are not derived from the Program,
|
||||||
and can be reasonably considered independent and separate works in
|
and can be reasonably considered independent and separate works in
|
||||||
themselves, then this License, and its terms, do not apply to those
|
themselves, then this License, and its terms, do not apply to those
|
||||||
sections when you distribute them as separate works. But when you
|
sections when you distribute them as separate works. But when you
|
||||||
distribute the same sections as part of a whole which is a work based
|
distribute the same sections as part of a whole which is a work based
|
||||||
on the Library, the distribution of the whole must be on the terms of
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
this License, whose permissions for other licensees extend to the
|
this License, whose permissions for other licensees extend to the
|
||||||
entire whole, and thus to each and every part regardless of who wrote
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
exercise the right to control the distribution of derivative or
|
exercise the right to control the distribution of derivative or
|
||||||
collective works based on the Library.
|
collective works based on the Program.
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Library
|
In addition, mere aggregation of another work not based on the Program
|
||||||
with the Library (or with a work based on the Library) on a volume of
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
a storage or distribution medium does not bring the other work under
|
a storage or distribution medium does not bring the other work under
|
||||||
the scope of this License.
|
the scope of this License.
|
||||||
|
|
||||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
License instead of this License to a given copy of the Library. To do
|
under Section 2) in object code or executable form under the terms of
|
||||||
this, you must alter all the notices that refer to this License, so
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
that they refer to the ordinary GNU General Public License, version 2,
|
|
||||||
instead of to this License. (If a newer version than version 2 of the
|
|
||||||
ordinary GNU General Public License has appeared, then you can specify
|
|
||||||
that version instead if you wish.) Do not make any other change in
|
|
||||||
these notices.
|
|
||||||
|
|
||||||
Once this change is made in a given copy, it is irreversible for
|
|
||||||
that copy, so the ordinary GNU General Public License applies to all
|
|
||||||
subsequent copies and derivative works made from that copy.
|
|
||||||
|
|
||||||
This option is useful when you wish to copy part of the code of
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
the Library into a program that is not a library.
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
4. You may copy and distribute the Library (or a portion or
|
b) Accompany it with a written offer, valid for at least three
|
||||||
derivative of it, under Section 2) in object code or executable form
|
years, to give any third party, for a charge no more than your
|
||||||
under the terms of Sections 1 and 2 above provided that you accompany
|
cost of physically performing source distribution, a complete
|
||||||
it with the complete corresponding machine-readable source code, which
|
machine-readable copy of the corresponding source code, to be
|
||||||
must be distributed under the terms of Sections 1 and 2 above on a
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
medium customarily used for software interchange.
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
If distribution of object code is made by offering access to copy
|
c) Accompany it with the information you received as to the offer
|
||||||
from a designated place, then offering equivalent access to copy the
|
to distribute corresponding source code. (This alternative is
|
||||||
source code from the same place satisfies the requirement to
|
allowed only for noncommercial distribution and only if you
|
||||||
distribute the source code, even though third parties are not
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
compelled to copy the source along with the object code.
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
5. A program that contains no derivative of any portion of the
|
|
||||||
Library, but is designed to work with the Library by being compiled or
|
|
||||||
linked with it, is called a "work that uses the Library". Such a
|
|
||||||
work, in isolation, is not a derivative work of the Library, and
|
|
||||||
therefore falls outside the scope of this License.
|
|
||||||
|
|
||||||
However, linking a "work that uses the Library" with the Library
|
|
||||||
creates an executable that is a derivative of the Library (because it
|
|
||||||
contains portions of the Library), rather than a "work that uses the
|
|
||||||
library". The executable is therefore covered by this License.
|
|
||||||
Section 6 states terms for distribution of such executables.
|
|
||||||
|
|
||||||
When a "work that uses the Library" uses material from a header file
|
|
||||||
that is part of the Library, the object code for the work may be a
|
|
||||||
derivative work of the Library even though the source code is not.
|
|
||||||
Whether this is true is especially significant if the work can be
|
|
||||||
linked without the Library, or if the work is itself a library. The
|
|
||||||
threshold for this to be true is not precisely defined by law.
|
|
||||||
|
|
||||||
If such an object file uses only numerical parameters, data
|
|
||||||
structure layouts and accessors, and small macros and small inline
|
|
||||||
functions (ten lines or less in length), then the use of the object
|
|
||||||
file is unrestricted, regardless of whether it is legally a derivative
|
|
||||||
work. (Executables containing this object code plus portions of the
|
|
||||||
Library will still fall under Section 6.)
|
|
||||||
|
|
||||||
Otherwise, if the work is a derivative of the Library, you may
|
|
||||||
distribute the object code for the work under the terms of Section 6.
|
|
||||||
Any executables containing that work also fall under Section 6,
|
|
||||||
whether or not they are linked directly with the Library itself.
|
|
||||||
|
|
||||||
6. As an exception to the Sections above, you may also combine or
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
link a "work that uses the Library" with the Library to produce a
|
except as expressly provided under this License. Any attempt
|
||||||
work containing portions of the Library, and distribute that work
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
under terms of your choice, provided that the terms permit
|
void, and will automatically terminate your rights under this License.
|
||||||
modification of the work for the customer's own use and reverse
|
However, parties who have received copies, or rights, from you under
|
||||||
engineering for debugging such modifications.
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
You must give prominent notice with each copy of the work that the
|
5. You are not required to accept this License, since you have not
|
||||||
Library is used in it and that the Library and its use are covered by
|
|
||||||
this License. You must supply a copy of this License. If the work
|
|
||||||
during execution displays copyright notices, you must include the
|
|
||||||
copyright notice for the Library among them, as well as a reference
|
|
||||||
directing the user to the copy of this License. Also, you must do one
|
|
||||||
of these things:
|
|
||||||
|
|
||||||
a) Accompany the work with the complete corresponding
|
|
||||||
machine-readable source code for the Library including whatever
|
|
||||||
changes were used in the work (which must be distributed under
|
|
||||||
Sections 1 and 2 above); and, if the work is an executable linked
|
|
||||||
with the Library, with the complete machine-readable "work that
|
|
||||||
uses the Library", as object code and/or source code, so that the
|
|
||||||
user can modify the Library and then relink to produce a modified
|
|
||||||
executable containing the modified Library. (It is understood
|
|
||||||
that the user who changes the contents of definitions files in the
|
|
||||||
Library will not necessarily be able to recompile the application
|
|
||||||
to use the modified definitions.)
|
|
||||||
|
|
||||||
b) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (1) uses at run time a
|
|
||||||
copy of the library already present on the user's computer system,
|
|
||||||
rather than copying library functions into the executable, and (2)
|
|
||||||
will operate properly with a modified version of the library, if
|
|
||||||
the user installs one, as long as the modified version is
|
|
||||||
interface-compatible with the version that the work was made with.
|
|
||||||
|
|
||||||
c) Accompany the work with a written offer, valid for at
|
|
||||||
least three years, to give the same user the materials
|
|
||||||
specified in Subsection 6a, above, for a charge no more
|
|
||||||
than the cost of performing this distribution.
|
|
||||||
|
|
||||||
d) If distribution of the work is made by offering access to copy
|
|
||||||
from a designated place, offer equivalent access to copy the above
|
|
||||||
specified materials from the same place.
|
|
||||||
|
|
||||||
e) Verify that the user has already received a copy of these
|
|
||||||
materials or that you have already sent this user a copy.
|
|
||||||
|
|
||||||
For an executable, the required form of the "work that uses the
|
|
||||||
Library" must include any data and utility programs needed for
|
|
||||||
reproducing the executable from it. However, as a special exception,
|
|
||||||
the materials to be distributed need not include anything that is
|
|
||||||
normally distributed (in either source or binary form) with the major
|
|
||||||
components (compiler, kernel, and so on) of the operating system on
|
|
||||||
which the executable runs, unless that component itself accompanies
|
|
||||||
the executable.
|
|
||||||
|
|
||||||
It may happen that this requirement contradicts the license
|
|
||||||
restrictions of other proprietary libraries that do not normally
|
|
||||||
accompany the operating system. Such a contradiction means you cannot
|
|
||||||
use both them and the Library together in an executable that you
|
|
||||||
distribute.
|
|
||||||
|
|
||||||
7. You may place library facilities that are a work based on the
|
|
||||||
Library side-by-side in a single library together with other library
|
|
||||||
facilities not covered by this License, and distribute such a combined
|
|
||||||
library, provided that the separate distribution of the work based on
|
|
||||||
the Library and of the other library facilities is otherwise
|
|
||||||
permitted, and provided that you do these two things:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work
|
|
||||||
based on the Library, uncombined with any other library
|
|
||||||
facilities. This must be distributed under the terms of the
|
|
||||||
Sections above.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library of the fact
|
|
||||||
that part of it is a work based on the Library, and explaining
|
|
||||||
where to find the accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
8. You may not copy, modify, sublicense, link with, or distribute
|
|
||||||
the Library except as expressly provided under this License. Any
|
|
||||||
attempt otherwise to copy, modify, sublicense, link with, or
|
|
||||||
distribute the Library is void, and will automatically terminate your
|
|
||||||
rights under this License. However, parties who have received copies,
|
|
||||||
or rights, from you under this License will not have their licenses
|
|
||||||
terminated so long as such parties remain in full compliance.
|
|
||||||
|
|
||||||
9. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
signed it. However, nothing else grants you permission to modify or
|
||||||
distribute the Library or its derivative works. These actions are
|
distribute the Program or its derivative works. These actions are
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
modifying or distributing the Library (or any work based on the
|
modifying or distributing the Program (or any work based on the
|
||||||
Library), you indicate your acceptance of this License to do so, and
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
all its terms and conditions for copying, distributing or modifying
|
all its terms and conditions for copying, distributing or modifying
|
||||||
the Library or works based on it.
|
the Program or works based on it.
|
||||||
|
|
||||||
10. Each time you redistribute the Library (or any work based on the
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
Library), the recipient automatically receives a license from the
|
Program), the recipient automatically receives a license from the
|
||||||
original licensor to copy, distribute, link with or modify the Library
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
subject to these terms and conditions. You may not impose any further
|
these terms and conditions. You may not impose any further
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
You are not responsible for enforcing compliance by third parties with
|
You are not responsible for enforcing compliance by third parties to
|
||||||
this License.
|
this License.
|
||||||
|
|
||||||
11. If, as a consequence of a court judgment or allegation of patent
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
infringement or for any other reason (not limited to patent issues),
|
infringement or for any other reason (not limited to patent issues),
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
excuse you from the conditions of this License. If you cannot
|
excuse you from the conditions of this License. If you cannot
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
License and any other pertinent obligations, then as a consequence you
|
License and any other pertinent obligations, then as a consequence you
|
||||||
may not distribute the Library at all. For example, if a patent
|
may not distribute the Program at all. For example, if a patent
|
||||||
license would not permit royalty-free redistribution of the Library by
|
license would not permit royalty-free redistribution of the Program by
|
||||||
all those who receive copies directly or indirectly through you, then
|
all those who receive copies directly or indirectly through you, then
|
||||||
the only way you could satisfy both it and this License would be to
|
the only way you could satisfy both it and this License would be to
|
||||||
refrain entirely from distribution of the Library.
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under any
|
If any portion of this section is held invalid or unenforceable under
|
||||||
particular circumstance, the balance of the section is intended to apply,
|
any particular circumstance, the balance of the section is intended to
|
||||||
and the section as a whole is intended to apply in other circumstances.
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
It is not the purpose of this section to induce you to infringe any
|
||||||
patents or other property right claims or to contest validity of any
|
patents or other property right claims or to contest validity of any
|
||||||
such claims; this section has the sole purpose of protecting the
|
such claims; this section has the sole purpose of protecting the
|
||||||
integrity of the free software distribution system which is
|
integrity of the free software distribution system, which is
|
||||||
implemented by public license practices. Many people have made
|
implemented by public license practices. Many people have made
|
||||||
generous contributions to the wide range of software distributed
|
generous contributions to the wide range of software distributed
|
||||||
through that system in reliance on consistent application of that
|
through that system in reliance on consistent application of that
|
||||||
@@ -401,104 +225,116 @@ impose that choice.
|
|||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
This section is intended to make thoroughly clear what is believed to
|
||||||
be a consequence of the rest of this License.
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
12. If the distribution and/or use of the Library is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Library under this License may add
|
|
||||||
an explicit geographical distribution limitation excluding those countries,
|
|
||||||
so that distribution is permitted only in or among countries not thus
|
|
||||||
excluded. In such case, this License incorporates the limitation as if
|
|
||||||
written in the body of this License.
|
|
||||||
|
|
||||||
13. The Free Software Foundation may publish revised and/or new
|
|
||||||
versions of the Lesser General Public License from time to time.
|
|
||||||
Such new versions will be similar in spirit to the present version,
|
|
||||||
but may differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Library
|
|
||||||
specifies a version number of this License which applies to it and
|
|
||||||
"any later version", you have the option of following the terms and
|
|
||||||
conditions either of that version or of any later version published by
|
|
||||||
the Free Software Foundation. If the Library does not specify a
|
|
||||||
license version number, you may choose any version ever published by
|
|
||||||
the Free Software Foundation.
|
|
||||||
|
|
||||||
14. If you wish to incorporate parts of the Library into other free
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
programs whose distribution conditions are incompatible with these,
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
write to the author to ask for permission. For software which is
|
original copyright holder who places the Program under this License
|
||||||
copyrighted by the Free Software Foundation, write to the Free
|
may add an explicit geographical distribution limitation excluding
|
||||||
Software Foundation; we sometimes make exceptions for this. Our
|
those countries, so that distribution is permitted only in or among
|
||||||
decision will be guided by the two goals of preserving the free status
|
countries not thus excluded. In such case, this License incorporates
|
||||||
of all derivatives of our free software and of promoting the sharing
|
the limitation as if written in the body of this License.
|
||||||
and reuse of software generally.
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
NO WARRANTY
|
NO WARRANTY
|
||||||
|
|
||||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Libraries
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
If you develop a new library, and you want it to be of the greatest
|
If you develop a new program, and you want it to be of the greatest
|
||||||
possible use to the public, we recommend making it free software that
|
possible use to the public, the best way to achieve this is to make it
|
||||||
everyone can redistribute and change. You can do so by permitting
|
free software which everyone can redistribute and change under these terms.
|
||||||
redistribution under these terms (or, alternatively, under the terms of the
|
|
||||||
ordinary General Public License).
|
|
||||||
|
|
||||||
To apply these terms, attach the following notices to the library. It is
|
To do so, attach the following notices to the program. It is safest
|
||||||
safest to attach them to the start of each source file to most effectively
|
to attach them to the start of each source file to most effectively
|
||||||
convey the exclusion of warranty; and each file should have at least the
|
convey the exclusion of warranty; and each file should have at least
|
||||||
"copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
<one line to give the library's name and a brief idea of what it does.>
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
Copyright (C) <year> <name of author>
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU Lesser General Public
|
it under the terms of the GNU General Public License as published by
|
||||||
License as published by the Free Software Foundation; either
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Lesser General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
You should also get your employer (if you work as a programmer) or your
|
||||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
necessary. Here is a sample; alter the names:
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1990
|
<signature of Ty Coon>, 1 April 1989
|
||||||
Ty Coon, President of Vice
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
That's all there is to it!
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
||||||
+21
-22
@@ -1,28 +1,29 @@
|
|||||||
SUBDIRS = externals src scripts corepkgs doc misc tests
|
SUBDIRS = externals src scripts corepkgs doc misc tests
|
||||||
EXTRA_DIST = substitute.mk nix.spec nix.spec.in bootstrap.sh \
|
EXTRA_DIST = substitute.mk nix.spec nix.spec.in bootstrap.sh \
|
||||||
nix.conf.example NEWS version
|
svn-revision nix.conf.example
|
||||||
|
|
||||||
pkginclude_HEADERS = config.h
|
|
||||||
|
|
||||||
include ./substitute.mk
|
include ./substitute.mk
|
||||||
|
|
||||||
nix.spec: nix.spec.in
|
nix.spec: nix.spec.in
|
||||||
|
|
||||||
|
rpm: nix.spec dist
|
||||||
|
rpm $(EXTRA_RPM_FLAGS) -ta $(distdir).tar.gz
|
||||||
|
|
||||||
|
relname:
|
||||||
|
echo -n $(distdir) > relname
|
||||||
|
|
||||||
install-data-local: init-state
|
install-data-local: init-state
|
||||||
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/nix
|
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/nix
|
||||||
$(INSTALL_DATA) $(srcdir)/nix.conf.example $(DESTDIR)$(sysconfdir)/nix
|
$(INSTALL_DATA) nix.conf.example $(DESTDIR)$(sysconfdir)/nix
|
||||||
if ! test -e $(DESTDIR)$(sysconfdir)/nix/nix.conf; then \
|
if ! test -e $(DESTDIR)$(sysconfdir)/nix/nix.conf; then \
|
||||||
$(INSTALL_DATA) $(srcdir)/nix.conf.example $(DESTDIR)$(sysconfdir)/nix/nix.conf; \
|
$(INSTALL_DATA) nix.conf.example $(DESTDIR)$(sysconfdir)/nix/nix.conf; \
|
||||||
fi
|
fi
|
||||||
$(INSTALL) -d $(DESTDIR)$(docdir)
|
|
||||||
$(INSTALL_DATA) README $(DESTDIR)$(docdir)/
|
|
||||||
|
|
||||||
if INIT_STATE
|
if INIT_STATE
|
||||||
|
if SETUID_HACK
|
||||||
# For setuid operation, you can enable the following:
|
INIT_FLAGS = -g @NIX_GROUP@ -o @NIX_USER@
|
||||||
# INIT_FLAGS = -g @NIX_GROUP@ -o @NIX_USER@
|
GROUP_WRITABLE = -m 775
|
||||||
# GROUP_WRITABLE = -m 775
|
endif
|
||||||
|
|
||||||
init-state:
|
init-state:
|
||||||
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix
|
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix
|
||||||
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix/db
|
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix/db
|
||||||
@@ -31,18 +32,16 @@ init-state:
|
|||||||
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix/profiles
|
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix/profiles
|
||||||
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix/gcroots
|
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix/gcroots
|
||||||
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix/temproots
|
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix/temproots
|
||||||
ln -sfn $(localstatedir)/nix/profiles $(DESTDIR)$(localstatedir)/nix/gcroots/profiles
|
$(INSTALL) $(INIT_FLAGS) $(GROUP_WRITABLE) -d $(DESTDIR)$(localstatedir)/nix/gcroots/tmp
|
||||||
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(localstatedir)/nix/userpool
|
$(INSTALL) $(INIT_FLAGS) $(GROUP_WRITABLE) -d $(DESTDIR)$(localstatedir)/nix/gcroots/channels
|
||||||
-$(INSTALL) $(INIT_FLAGS) -m 1777 -d $(DESTDIR)$(storedir)
|
rm -f $(DESTDIR)$(localstatedir)/nix/gcroots/profiles
|
||||||
|
ln -s $(localstatedir)/nix/profiles $(DESTDIR)$(localstatedir)/nix/gcroots/profiles
|
||||||
|
$(INSTALL) $(INIT_FLAGS) -d $(DESTDIR)$(prefix)/store
|
||||||
$(INSTALL) $(INIT_FLAGS) $(GROUP_WRITABLE) -d $(DESTDIR)$(localstatedir)/nix/manifests
|
$(INSTALL) $(INIT_FLAGS) $(GROUP_WRITABLE) -d $(DESTDIR)$(localstatedir)/nix/manifests
|
||||||
ln -sfn $(localstatedir)/nix/manifests $(DESTDIR)$(localstatedir)/nix/gcroots/manifests
|
# $(bindir)/nix-store --init
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
init-state:
|
init-state:
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
NEWS:
|
svn-revision:
|
||||||
$(MAKE) -C doc/manual NEWS.txt
|
svnversion . > svn-revision
|
||||||
cp $(srcdir)/doc/manual/NEWS.txt NEWS
|
|
||||||
@@ -0,0 +1,255 @@
|
|||||||
|
Version 0.8 (April 11, 2005)
|
||||||
|
|
||||||
|
NOTE: the hashing scheme in Nix 0.8 changed (as detailed below). As a
|
||||||
|
result, `nix-pull' manifests and channels built for Nix 0.7 and below
|
||||||
|
will now work anymore. However, the Nix expression language has not
|
||||||
|
changed, so you can still build from source. Also, existing user
|
||||||
|
environments continue to work. Nix 0.8 will automatically upgrade the
|
||||||
|
database schema of previous installations when it is first run.
|
||||||
|
|
||||||
|
If you get the error message
|
||||||
|
|
||||||
|
you have an old-style manifest `/nix/var/nix/manifests/[...]';
|
||||||
|
please delete it
|
||||||
|
|
||||||
|
you should delete previously downloaded manifests:
|
||||||
|
|
||||||
|
$ rm /nix/var/nix/manifests/*
|
||||||
|
|
||||||
|
If `nix-channel' gives the error message
|
||||||
|
|
||||||
|
manifest `http://catamaran.labs.cs.uu.nl/dist/nix/channels/[channel]/MANIFEST'
|
||||||
|
is too old (i.e., for Nix <= 0.7)
|
||||||
|
|
||||||
|
then you should unsubscribe from the offending channel (`nix-channel
|
||||||
|
--remove URL'; leave out `/MANIFEST'), and subscribe to the same URL,
|
||||||
|
with `channels' replaced by `channels-v3' (e.g.,
|
||||||
|
http://catamaran.labs.cs.uu.nl/dist/nix/channels-v3/nixpkgs-unstable).
|
||||||
|
|
||||||
|
Nix 0.8 has the following improvements:
|
||||||
|
|
||||||
|
* The cryptographic hashes used in store paths are now 160 bits long,
|
||||||
|
but encoded in base-32 so that they are still only 32 characters
|
||||||
|
long (e.g., /nix/store/csw87wag8bqlqk7ipllbwypb14xainap-atk-1.9.0).
|
||||||
|
(This is actually a 160 bit truncation of a SHA-256 hash.)
|
||||||
|
|
||||||
|
* Big cleanups and simplifications of the basic store semantics. The
|
||||||
|
notion of "closure store expressions" is gone (and so is the notion
|
||||||
|
of "successors"); the file system references of a store path are now
|
||||||
|
just stored in the database.
|
||||||
|
|
||||||
|
For instance, given any store path, you can query its closure:
|
||||||
|
|
||||||
|
$ nix-store -qR $(which firefox)
|
||||||
|
... lots of paths ...
|
||||||
|
|
||||||
|
Also, Nix now remembers for each store path the derivation that
|
||||||
|
built it (the "deriver"):
|
||||||
|
|
||||||
|
$ nix-store -qR $(which firefox)
|
||||||
|
/nix/store/4b0jx7vq80l9aqcnkszxhymsf1ffa5jd-firefox-1.0.1.drv
|
||||||
|
|
||||||
|
So to see the build-time dependencies, you can do
|
||||||
|
|
||||||
|
$ nix-store -qR $(nix-store -qd $(which firefox))
|
||||||
|
|
||||||
|
or, in a nicer format:
|
||||||
|
|
||||||
|
$ nix-store -q --tree $(nix-store -qd $(which firefox))
|
||||||
|
|
||||||
|
File system references are also stored in reverse. For instance,
|
||||||
|
you can query all paths that directly or indirectly use a certain
|
||||||
|
Glibc:
|
||||||
|
|
||||||
|
$ nix-store -q --referers-closure \
|
||||||
|
/nix/store/8lz9yc6zgmc0vlqmn2ipcpkjlmbi51vv-glibc-2.3.4
|
||||||
|
|
||||||
|
* The concept of fixed-output derivations has been formalised.
|
||||||
|
Previously, functions such as `fetchurl' in Nixpkgs used a hack
|
||||||
|
(namely, explicitly specifying a store path hash) to prevent changes
|
||||||
|
to, say, the URL of the file from propagating upwards through the
|
||||||
|
dependency graph, causing rebuilds of everything. This can now be
|
||||||
|
done cleanly by specifying the `outputHash' and `outputHashAlgo'
|
||||||
|
attributes. Nix itself checks that the content of the output has
|
||||||
|
the specified hash. (This is important for maintaining certain
|
||||||
|
invariants necessary for future work on secure shared stores.)
|
||||||
|
|
||||||
|
* One-click installation :-) It is now possible to install any
|
||||||
|
top-level component in Nixpkgs directly, through the web - see,
|
||||||
|
e.g., http://catamaran.labs.cs.uu.nl/dist/nixpkgs-0.8/. All you
|
||||||
|
have to do is associate `/nix/bin/nix-install-package' with the MIME
|
||||||
|
type `application/nix-package' (or the extension `.nixpkg'), and
|
||||||
|
clicking on a package link will cause it to be installed, with all
|
||||||
|
appropriate dependencies. If you just want to install some specific
|
||||||
|
application, this is easier than subscribing to a channel.
|
||||||
|
|
||||||
|
* `nix-store -r PATHS' now builds all the derivations PATHS in
|
||||||
|
parallel. Previously it did them sequentially (though exploiting
|
||||||
|
possible parallelism between subderivations). This is nice for
|
||||||
|
build farms.
|
||||||
|
|
||||||
|
* `nix-channel' has new operations `--list' and `--remove'.
|
||||||
|
|
||||||
|
* New ways of installing components into user environments:
|
||||||
|
|
||||||
|
- Copy from another user environment:
|
||||||
|
|
||||||
|
$ nix-env -i --from-profile .../other-profile firefox
|
||||||
|
|
||||||
|
- Install a store derivation directly (bypassing the Nix expression
|
||||||
|
language entirely):
|
||||||
|
|
||||||
|
$ nix-env -i /nix/store/z58v41v21xd3...-aterm-2.3.1.drv
|
||||||
|
|
||||||
|
(This is used to implement `nix-install-package', which is
|
||||||
|
therefore immune to evolution in the Nix expression language.)
|
||||||
|
|
||||||
|
- Install an already built store path directly:
|
||||||
|
|
||||||
|
$ nix-env -i /nix/store/hsyj5pbn0d9i...-aterm-2.3.1
|
||||||
|
|
||||||
|
- Install the result of a Nix expression specified as a command-line
|
||||||
|
argument:
|
||||||
|
|
||||||
|
$ nix-env -f .../i686-linux.nix -i -E 'x: x.firefoxWrapper'
|
||||||
|
|
||||||
|
The difference with the normal installation mode is that `-E' does
|
||||||
|
not use the `name' attributes of derivations. Therefore, this can
|
||||||
|
be used to disambiguate multiple derivations with the same name.
|
||||||
|
|
||||||
|
* A hash of the contents of a store path is now stored in the database
|
||||||
|
after a succesful build. This allows you to check whether store
|
||||||
|
paths have been tampered with: `nix-store --verify --check-contents'.
|
||||||
|
|
||||||
|
* Implemented a concurrent garbage collector. It is now always safe
|
||||||
|
to run the garbage collector, even if other Nix operations are
|
||||||
|
happening simultaneously.
|
||||||
|
|
||||||
|
However, there can still be GC races if you use `nix-instantiate'
|
||||||
|
and `nix-store -r' directly to build things. To prevent races, use
|
||||||
|
the `--add-root' flag of those commands.
|
||||||
|
|
||||||
|
* The garbage collector now finally deletes paths in the right order
|
||||||
|
(i.e., topologically sorted under the `references' relation), thus
|
||||||
|
making it safe to interrupt the collector without risking a store
|
||||||
|
that violates the closure invariant.
|
||||||
|
|
||||||
|
* Likewise, the substitute mechanism now downloads files in the right
|
||||||
|
order, thus preserving the closure invariant at all times.
|
||||||
|
|
||||||
|
* The result of `nix-build' is now registered as a root of the garbage
|
||||||
|
collector. If the `./result' link is deleted, the GC root
|
||||||
|
disappears automatically.
|
||||||
|
|
||||||
|
* The behaviour of the garbage collector can be changed globally by
|
||||||
|
setting options in `/nix/etc/nix/nix.conf'.
|
||||||
|
|
||||||
|
- `gc-keep-derivations' specifies whether deriver links should be
|
||||||
|
followed when searching for live paths.
|
||||||
|
|
||||||
|
- `gc-keep-outputs' specifies whether outputs of derivations should
|
||||||
|
be followed when searching for live paths.
|
||||||
|
|
||||||
|
- `env-keep-derivations' specifies whether user environments should
|
||||||
|
store the paths of derivations when they are added (thus keeping
|
||||||
|
the derivations alive).
|
||||||
|
|
||||||
|
* New `nix-env' query flags `--drv-path' and `--out-path'.
|
||||||
|
|
||||||
|
* `fetchurl' allows SHA-1 and SHA-256 in addition to MD5. Just
|
||||||
|
specify the attribute `sha1' or `sha256' instead of `md5'.
|
||||||
|
|
||||||
|
* Manual updates.
|
||||||
|
|
||||||
|
|
||||||
|
Version 0.7 (January 12, 2005)
|
||||||
|
|
||||||
|
* Binary patching. When upgrading components using pre-built binaries
|
||||||
|
(through nix-pull / nix-channel), Nix can automatically download and
|
||||||
|
apply binary patches to already installed components instead of full
|
||||||
|
downloads. Patching is "smart": if there is a *sequence* of patches
|
||||||
|
to an installed component, Nix will use it. Patches are currently
|
||||||
|
generated automatically between Nixpkgs (pre-)releases.
|
||||||
|
|
||||||
|
* Simplifications to the substitute mechanism.
|
||||||
|
|
||||||
|
* Nix-pull now stores downloaded manifests in /nix/var/nix/manifests.
|
||||||
|
|
||||||
|
* Metadata on files in the Nix store is canonicalised after builds:
|
||||||
|
the last-modified timestamp is set to 0 (00:00:00 1/1/1970), the
|
||||||
|
mode is set to 0444 or 0555 (readable and possibly executable by
|
||||||
|
all; setuid/setgid bits are dropped), and the group is set to the
|
||||||
|
default. This ensures that the result of a build and an
|
||||||
|
installation through a substitute is the same; and that timestamp
|
||||||
|
dependencies are revealed.
|
||||||
|
|
||||||
|
|
||||||
|
Version 0.6 (November 14, 2004)
|
||||||
|
|
||||||
|
Major changes include the following:
|
||||||
|
|
||||||
|
* Rewrite of the normalisation engine.
|
||||||
|
|
||||||
|
* Multiple builds can now be performed in parallel (option `-j').
|
||||||
|
|
||||||
|
* Distributed builds. Nix can now call a shell script to forward
|
||||||
|
builds to Nix installations on remote machines, which may or may
|
||||||
|
not be of the same platform type.
|
||||||
|
|
||||||
|
* Option `--fallback' allows recovery from broken substitutes.
|
||||||
|
|
||||||
|
* Option `--keep-going' causes building of other (unaffected)
|
||||||
|
derivations to continue if one failed.
|
||||||
|
|
||||||
|
* Improvements to the garbage collector (i.e., it should actually work
|
||||||
|
now).
|
||||||
|
|
||||||
|
* Setuid Nix installations allow a Nix store to be shared among
|
||||||
|
multiple users.
|
||||||
|
|
||||||
|
* Substitute registration is much faster now.
|
||||||
|
|
||||||
|
* A utility `nix-build' to build a Nix expression and create a symlink
|
||||||
|
to the result int the current directory; useful for testing Nix
|
||||||
|
derivations.
|
||||||
|
|
||||||
|
* Manual updates.
|
||||||
|
|
||||||
|
* `nix-env' changes:
|
||||||
|
|
||||||
|
* Derivations for other platforms are filtered out (which can be
|
||||||
|
overriden using `--system-filter').
|
||||||
|
|
||||||
|
* `--install' by default now uninstall previous derivations with the
|
||||||
|
same name.
|
||||||
|
|
||||||
|
* `--upgrade' allows upgrading to a specific version.
|
||||||
|
|
||||||
|
* New operation `--delete-generations' to remove profile
|
||||||
|
generations (necessary for effective garbage collection).
|
||||||
|
|
||||||
|
* Nicer output (sorted, columnised).
|
||||||
|
|
||||||
|
* More sensible verbosity levels all around (builder output is now
|
||||||
|
shown always, unless `-Q' is given).
|
||||||
|
|
||||||
|
* Nix expression language changes:
|
||||||
|
|
||||||
|
* New language construct: `with E1; E2' brings all attributes
|
||||||
|
defined in the attribute set E1 in scope in E2.
|
||||||
|
|
||||||
|
* Added a `map' function.
|
||||||
|
|
||||||
|
* Various new operators (e.g., string concatenation).
|
||||||
|
|
||||||
|
* Expression evaluation is much faster.
|
||||||
|
|
||||||
|
* An Emacs mode for editing Nix expressions (with syntax highlighting
|
||||||
|
and indentation) has been added.
|
||||||
|
|
||||||
|
* Many bug fixes.
|
||||||
|
|
||||||
|
|
||||||
|
Version 0.5 and earlier
|
||||||
|
|
||||||
|
Please refer to the Subversion commit log messages.
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
Nix is a purely functional package manager. For installation and
|
For installation and usage instructions, please read the manual, which
|
||||||
usage instructions, please read the manual, which can be found in
|
can be found in `docs/manual/manual.html', and additionally at the Nix
|
||||||
`docs/manual/manual.html', and additionally at the Nix website at
|
website at <http://www.cs.uu.nl/groups/ST/Trace/Nix>.
|
||||||
<http://nixos.org/>.
|
|
||||||
|
|
||||||
|
|
||||||
Acknowledgments
|
Acknowledgments
|
||||||
|
|
||||||
This product includes software developed by the OpenSSL Project for
|
This product includes software developed by the OpenSSL Project for
|
||||||
use in the OpenSSL Toolkit (http://www.OpenSSL.org/).
|
use in the OpenSSL Toolkit (http://www.OpenSSL.org/)
|
||||||
-149
@@ -1,149 +0,0 @@
|
|||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect_minor
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect_minor
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Value4
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect_minor
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Value8
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect_minor
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Value4
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect_minor
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Value8
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect_minor
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Addr4
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect_minor
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Addr8
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect_minor
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Value4
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Value8
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Addr4
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Addr8
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Value4
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Value8
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:AT_collect
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Value4
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:mark_phase
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:mark_phase
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Value4
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:mark_phase_young
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ATerm library conservatively scans for GC roots
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:mark_phase_young
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
#! /bin/sh -e
|
#! /bin/sh -e
|
||||||
rm -f aclocal.m4
|
|
||||||
mkdir -p config
|
|
||||||
libtoolize --copy
|
|
||||||
aclocal
|
aclocal
|
||||||
autoheader
|
autoheader
|
||||||
automake --add-missing --copy
|
automake --add-missing --copy
|
||||||
|
|||||||
+85
-208
@@ -1,28 +1,34 @@
|
|||||||
AC_INIT(nix, m4_esyscmd([echo -n $(cat ./version)$VERSION_SUFFIX]))
|
AC_INIT(nix, "0.8")
|
||||||
AC_CONFIG_SRCDIR(README)
|
AC_CONFIG_SRCDIR(README)
|
||||||
AC_CONFIG_AUX_DIR(config)
|
AC_CONFIG_AUX_DIR(config)
|
||||||
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
|
AM_INIT_AUTOMAKE
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED(NIX_VERSION, ["$VERSION"], [Nix version.])
|
# Change to `1' to produce a `stable' release (i.e., the `preREVISION'
|
||||||
|
# suffix is not added).
|
||||||
|
STABLE=1
|
||||||
|
|
||||||
|
# Put the revision number in the version.
|
||||||
|
if test "$STABLE" != "1"; then
|
||||||
|
if REVISION=`test -d $srcdir/.svn && svnversion $srcdir 2> /dev/null`; then
|
||||||
|
VERSION="${VERSION}pre${REVISION}"
|
||||||
|
elif REVISION=`cat $srcdir/svn-revision 2> /dev/null`; then
|
||||||
|
VERSION="${VERSION}pre${REVISION}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_PREFIX_DEFAULT(/nix)
|
||||||
|
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
|
||||||
|
|
||||||
# Construct a Nix system name (like "i686-linux").
|
# Construct a Nix system name (like "i686-linux").
|
||||||
AC_MSG_CHECKING([for the canonical Nix system name])
|
AC_MSG_CHECKING([for the canonical Nix system name])
|
||||||
cpu_name=$(uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ' 'abcdefghijklmnopqrstuvwxyz_')
|
cpu_name=$(uname -p | tr 'A-Z ' 'a-z_')
|
||||||
machine_name=$(uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ' 'abcdefghijklmnopqrstuvwxyz_')
|
machine_name=$(uname -m | tr 'A-Z ' 'a-z_')
|
||||||
|
|
||||||
case $machine_name in
|
case $machine_name in
|
||||||
i*86)
|
i*86)
|
||||||
machine_name=i686
|
machine_name=i686
|
||||||
;;
|
;;
|
||||||
x86_64)
|
|
||||||
machine_name=x86_64
|
|
||||||
;;
|
|
||||||
ppc)
|
|
||||||
machine_name=powerpc
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
if test "$cpu_name" != "unknown"; then
|
if test "$cpu_name" != "unknown"; then
|
||||||
machine_name=$cpu_name
|
machine_name=$cpu_name
|
||||||
@@ -30,73 +36,17 @@ case $machine_name in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
sys_name=$(uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ' 'abcdefghijklmnopqrstuvwxyz_')
|
sys_name=$(uname -s | tr 'A-Z ' 'a-z_')
|
||||||
|
|
||||||
case $sys_name in
|
|
||||||
cygwin*)
|
|
||||||
sys_name=cygwin
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AC_ARG_WITH(system, AC_HELP_STRING([--with-system=SYSTEM],
|
AC_ARG_WITH(system, AC_HELP_STRING([--with-system=SYSTEM],
|
||||||
[Platform identifier (e.g., `i686-linux').]),
|
[platform identifier (e.g., `i686-linux')]),
|
||||||
system=$withval, system="${machine_name}-${sys_name}")
|
system=$withval, system="${machine_name}-${sys_name}")
|
||||||
AC_MSG_RESULT($system)
|
AC_MSG_RESULT($system)
|
||||||
AC_SUBST(system)
|
AC_SUBST(system)
|
||||||
AC_DEFINE_UNQUOTED(SYSTEM, ["$system"], [platform identifier (`cpu-os')])
|
AC_DEFINE_UNQUOTED(SYSTEM, ["$system"], [platform identifier (`cpu-os')])
|
||||||
|
|
||||||
|
|
||||||
# State should be stored in /nix/var, unless the user overrides it explicitly.
|
|
||||||
test "$localstatedir" = '${prefix}/var' && localstatedir=/nix/var
|
|
||||||
|
|
||||||
|
|
||||||
# Windows-specific stuff. On Cygwin, dynamically linking against the
|
|
||||||
# ATerm DLL works, except that it requires the ATerm "lib" directory
|
|
||||||
# to be in $PATH, as Windows doesn't have anything like an RPATH
|
|
||||||
# embedded in executable. Since this is kind of annoying, we use
|
|
||||||
# static libraries for now.
|
|
||||||
if test "$sys_name" = "cygwin"; then
|
|
||||||
AC_DISABLE_SHARED
|
|
||||||
AC_ENABLE_STATIC
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Solaris-specific stuff.
|
|
||||||
if test "$sys_name" = "sunos"; then
|
|
||||||
# Solaris requires -lsocket -lnsl for network functions
|
|
||||||
LIBS="-lsocket -lnsl $LIBS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
|
AC_PROG_RANLIB
|
||||||
# To build programs to be run in the build machine
|
|
||||||
if test "$CC_FOR_BUILD" = ""; then
|
|
||||||
if test "$cross_compiling" = "yes"; then
|
|
||||||
AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
|
|
||||||
else
|
|
||||||
CC_FOR_BUILD="$CC"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
AC_SUBST([CC_FOR_BUILD])
|
|
||||||
|
|
||||||
# We are going to use libtool.
|
|
||||||
AC_DISABLE_STATIC
|
|
||||||
AC_ENABLE_SHARED
|
|
||||||
AC_PROG_LIBTOOL
|
|
||||||
|
|
||||||
if test "$enable_shared" = yes; then
|
|
||||||
SUB_CONFIGURE_FLAGS="--enable-shared --disable-static"
|
|
||||||
else
|
|
||||||
SUB_CONFIGURE_FLAGS="--enable-static --disable-shared"
|
|
||||||
fi
|
|
||||||
AC_SUBST(SUB_CONFIGURE_FLAGS)
|
|
||||||
|
|
||||||
|
|
||||||
# Use 64-bit file system calls so that we can support files > 2 GiB.
|
|
||||||
AC_SYS_LARGEFILE
|
|
||||||
|
|
||||||
|
|
||||||
# Check for pubsetbuf.
|
# Check for pubsetbuf.
|
||||||
AC_MSG_CHECKING([for pubsetbuf])
|
AC_MSG_CHECKING([for pubsetbuf])
|
||||||
@@ -105,45 +55,15 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
static char buf[1024];]],
|
static char buf[1024];]],
|
||||||
[[cerr.rdbuf()->pubsetbuf(buf, sizeof(buf));]])],
|
[[cerr.rdbuf()->pubsetbuf(buf, sizeof(buf));]])],
|
||||||
[AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PUBSETBUF, 1, [Whether pubsetbuf is available.])],
|
[AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PUBSETBUF, 1, [whether pubsetbuf is available])],
|
||||||
AC_MSG_RESULT(no))
|
AC_MSG_RESULT(no))
|
||||||
AC_LANG_POP(C++)
|
AC_LANG_POP(C++)
|
||||||
|
|
||||||
|
# Check for <locale>
|
||||||
# Check for chroot support (requires chroot() and bind mounts).
|
|
||||||
AC_CHECK_FUNCS([chroot])
|
|
||||||
AC_CHECK_FUNCS([unshare])
|
|
||||||
AC_CHECK_HEADERS([sched.h], [], [], [])
|
|
||||||
AC_CHECK_HEADERS([sys/param.h], [], [], [])
|
|
||||||
AC_CHECK_HEADERS([sys/mount.h], [], [],
|
|
||||||
[#ifdef HAVE_SYS_PARAM_H
|
|
||||||
# include <sys/param.h>
|
|
||||||
# endif
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# Check for <locale>.
|
|
||||||
AC_LANG_PUSH(C++)
|
AC_LANG_PUSH(C++)
|
||||||
AC_CHECK_HEADERS([locale], [], [], [])
|
AC_CHECK_HEADERS([locale])
|
||||||
AC_LANG_POP(C++)
|
AC_LANG_POP(C++)
|
||||||
|
|
||||||
|
|
||||||
# Check for <err.h>.
|
|
||||||
AC_CHECK_HEADER([err.h], [], [bsddiff_compat_include="-Icompat-include"])
|
|
||||||
AC_SUBST([bsddiff_compat_include])
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether we have the personality() syscall, which allows us to
|
|
||||||
# do i686-linux builds on x86_64-linux machines.
|
|
||||||
AC_CHECK_HEADERS([sys/personality.h])
|
|
||||||
|
|
||||||
|
|
||||||
# Check for tr1/unordered_set.
|
|
||||||
AC_LANG_PUSH(C++)
|
|
||||||
AC_CHECK_HEADERS([tr1/unordered_set], [], [], [])
|
|
||||||
AC_LANG_POP(C++)
|
|
||||||
|
|
||||||
|
|
||||||
AC_DEFUN([NEED_PROG],
|
AC_DEFUN([NEED_PROG],
|
||||||
[
|
[
|
||||||
AC_PATH_PROG($1, $2)
|
AC_PATH_PROG($1, $2)
|
||||||
@@ -153,43 +73,26 @@ fi
|
|||||||
])
|
])
|
||||||
|
|
||||||
NEED_PROG(curl, curl)
|
NEED_PROG(curl, curl)
|
||||||
NEED_PROG(bash, bash)
|
NEED_PROG(bzip2, bzip2)
|
||||||
NEED_PROG(patch, patch)
|
NEED_PROG(bunzip2, bunzip2)
|
||||||
|
NEED_PROG(shell, sh)
|
||||||
AC_PATH_PROG(xmllint, xmllint, false)
|
AC_PATH_PROG(xmllint, xmllint, false)
|
||||||
AC_PATH_PROG(xsltproc, xsltproc, false)
|
AC_PATH_PROG(xsltproc, xsltproc, false)
|
||||||
AC_PATH_PROG(w3m, w3m, false)
|
|
||||||
AC_PATH_PROG(flex, flex, false)
|
AC_PATH_PROG(flex, flex, false)
|
||||||
AC_PATH_PROG(bison, bison, false)
|
AC_PATH_PROG(bison, bison, false)
|
||||||
NEED_PROG(perl, perl)
|
NEED_PROG(perl, perl)
|
||||||
NEED_PROG(sed, sed)
|
|
||||||
NEED_PROG(tar, tar)
|
NEED_PROG(tar, tar)
|
||||||
AC_PATH_PROG(dot, dot)
|
|
||||||
AC_PATH_PROG(dblatex, dblatex)
|
|
||||||
AC_PATH_PROG(gzip, gzip)
|
|
||||||
|
|
||||||
AC_PATH_PROG(openssl_prog, openssl, openssl) # if not found, call openssl in $PATH
|
|
||||||
AC_SUBST(openssl_prog)
|
|
||||||
AC_DEFINE_UNQUOTED(OPENSSL_PATH, ["$openssl_prog"], [Path of the OpenSSL binary])
|
|
||||||
|
|
||||||
# Test that Perl has the open/fork feature (Perl 5.8.0 and beyond).
|
|
||||||
AC_MSG_CHECKING([whether Perl is recent enough])
|
|
||||||
if ! $perl -e 'open(FOO, "-|", "true"); while (<FOO>) { print; }; close FOO or die;'; then
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
AC_MSG_ERROR([Your Perl version is too old. Nix requires Perl 5.8.0 or newer.])
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
|
|
||||||
NEED_PROG(cat, cat)
|
NEED_PROG(cat, cat)
|
||||||
NEED_PROG(tr, tr)
|
|
||||||
AC_ARG_WITH(coreutils-bin, AC_HELP_STRING([--with-coreutils-bin=PATH],
|
AC_ARG_WITH(coreutils-bin, AC_HELP_STRING([--with-coreutils-bin=PATH],
|
||||||
[path of cat, mkdir, etc.]),
|
[path of cat, mkdir, etc.]),
|
||||||
coreutils=$withval, coreutils=$(dirname $cat))
|
coreutils=$withval, coreutils=$(dirname $cat))
|
||||||
AC_SUBST(coreutils)
|
AC_SUBST(coreutils)
|
||||||
|
|
||||||
AC_ARG_WITH(docbook-rng, AC_HELP_STRING([--with-docbook-rng=PATH],
|
AC_ARG_WITH(docbook-catalog, AC_HELP_STRING([--with-docbook-catalog=PATH],
|
||||||
[path of the DocBook RelaxNG schema]),
|
[path of the DocBook XML DTD]),
|
||||||
docbookrng=$withval, docbookrng=/docbook-rng-missing)
|
docbookcatalog=$withval, docbookcatalog=/docbook-dtd-missing)
|
||||||
AC_SUBST(docbookrng)
|
AC_SUBST(docbookcatalog)
|
||||||
|
|
||||||
AC_ARG_WITH(docbook-xsl, AC_HELP_STRING([--with-docbook-xsl=PATH],
|
AC_ARG_WITH(docbook-xsl, AC_HELP_STRING([--with-docbook-xsl=PATH],
|
||||||
[path of the DocBook XSL stylesheets]),
|
[path of the DocBook XSL stylesheets]),
|
||||||
@@ -203,77 +106,41 @@ AC_SUBST(xmlflags)
|
|||||||
|
|
||||||
AC_ARG_WITH(store-dir, AC_HELP_STRING([--with-store-dir=PATH],
|
AC_ARG_WITH(store-dir, AC_HELP_STRING([--with-store-dir=PATH],
|
||||||
[path of the Nix store]),
|
[path of the Nix store]),
|
||||||
storedir=$withval, storedir='/nix/store')
|
storedir=$withval, storedir='${prefix}/store')
|
||||||
AC_SUBST(storedir)
|
AC_SUBST(storedir)
|
||||||
|
|
||||||
AC_ARG_WITH(openssl, AC_HELP_STRING([--with-openssl=PATH],
|
AC_ARG_WITH(bdb, AC_HELP_STRING([--with-bdb=PATH],
|
||||||
[prefix of the OpenSSL library]),
|
[prefix of Berkeley DB]),
|
||||||
openssl=$withval, openssl=)
|
bdb=$withval, bdb=)
|
||||||
AM_CONDITIONAL(HAVE_OPENSSL, test -n "$openssl")
|
AM_CONDITIONAL(HAVE_BDB, test -n "$bdb")
|
||||||
if test -n "$openssl"; then
|
if test -z "$bdb"; then
|
||||||
LDFLAGS="-L$openssl/lib -lcrypto $LDFLAGS"
|
bdb_lib='-L${top_builddir}/externals/inst-bdb/lib -ldb_cxx'
|
||||||
CFLAGS="-I$openssl/include $CFLAGS"
|
bdb_include='-I${top_builddir}/externals/inst-bdb/include'
|
||||||
CXXFLAGS="-I$openssl/include $CXXFLAGS"
|
|
||||||
AC_DEFINE(HAVE_OPENSSL, 1, [Whether to use OpenSSL.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_WITH(bzip2, AC_HELP_STRING([--with-bzip2=PATH],
|
|
||||||
[prefix of bzip2]),
|
|
||||||
bzip2=$withval, bzip2=)
|
|
||||||
AM_CONDITIONAL(HAVE_BZIP2, test -n "$bzip2")
|
|
||||||
ATERM_VERSION=2.5
|
|
||||||
AC_SUBST(ATERM_VERSION)
|
|
||||||
if test -z "$bzip2"; then
|
|
||||||
# Headers and libraries will be used from the temporary installation
|
|
||||||
# in externals/inst-bzip2.
|
|
||||||
bzip2_lib='-L${top_builddir}/externals/inst-bzip2/lib -lbz2'
|
|
||||||
bzip2_include='-I${top_builddir}/externals/inst-bzip2/include'
|
|
||||||
# The binary will be copied to $libexecdir.
|
|
||||||
bzip2_bin='${libexecdir}/nix'
|
|
||||||
# But for testing, we have to use the temporary copy :-(
|
|
||||||
bzip2_bin_test='${top_builddir}/externals/inst-bzip2/bin'
|
|
||||||
else
|
else
|
||||||
bzip2_lib="-L$bzip2/lib -lbz2"
|
bdb_lib="-L$bdb/lib -ldb_cxx"
|
||||||
bzip2_include="-I$bzip2/include"
|
bdb_include="-I$bdb/include"
|
||||||
bzip2_bin="$bzip2/bin"
|
|
||||||
bzip2_bin_test="$bzip2/bin"
|
|
||||||
fi
|
fi
|
||||||
AC_SUBST(bzip2_lib)
|
AC_SUBST(bdb_lib)
|
||||||
AC_SUBST(bzip2_include)
|
AC_SUBST(bdb_include)
|
||||||
AC_SUBST(bzip2_bin)
|
|
||||||
AC_SUBST(bzip2_bin_test)
|
|
||||||
|
|
||||||
AC_ARG_WITH(sqlite, AC_HELP_STRING([--with-sqlite=PATH],
|
AC_ARG_WITH(aterm, AC_HELP_STRING([--with-aterm=PATH],
|
||||||
[prefix of SQLite]),
|
[prefix of CWI ATerm library]),
|
||||||
sqlite=$withval, sqlite=)
|
aterm=$withval, aterm=)
|
||||||
AM_CONDITIONAL(HAVE_SQLITE, test -n "$sqlite")
|
AM_CONDITIONAL(HAVE_ATERM, test -n "$aterm")
|
||||||
SQLITE_VERSION=3070500
|
if test -z "$aterm"; then
|
||||||
AC_SUBST(SQLITE_VERSION)
|
aterm_lib='-L${top_builddir}/externals/inst-aterm/lib -lATerm'
|
||||||
if test -z "$sqlite"; then
|
aterm_include='-I${top_builddir}/externals/inst-aterm/include'
|
||||||
sqlite_lib='${top_builddir}/externals/sqlite-autoconf-$(SQLITE_VERSION)/libsqlite3.la'
|
aterm_bin='${top_builddir}/externals/inst-aterm/bin'
|
||||||
sqlite_include='-I${top_builddir}/externals/sqlite-autoconf-$(SQLITE_VERSION)'
|
|
||||||
sqlite_bin='${top_builddir}/externals/sqlite-autoconf-$(SQLITE_VERSION)'
|
|
||||||
else
|
else
|
||||||
sqlite_lib="-L$sqlite/lib -lsqlite3"
|
aterm_lib="-L$aterm/lib -lATerm"
|
||||||
sqlite_include="-I$sqlite/include"
|
aterm_include="-I$aterm/include"
|
||||||
sqlite_bin="$sqlite/bin"
|
aterm_bin="$aterm/bin"
|
||||||
fi
|
fi
|
||||||
AC_SUBST(sqlite_lib)
|
AC_SUBST(aterm_lib)
|
||||||
AC_SUBST(sqlite_include)
|
AC_SUBST(aterm_include)
|
||||||
AC_SUBST(sqlite_bin)
|
AC_SUBST(aterm_bin)
|
||||||
|
|
||||||
# Whether to use the Boehm garbage collector.
|
|
||||||
AC_ARG_ENABLE(gc, AC_HELP_STRING([--enable-gc],
|
|
||||||
[enable garbage collection in the Nix expression evaluator (requires Boehm GC)]),
|
|
||||||
gc=$enableval, gc=)
|
|
||||||
if test -n "$gc"; then
|
|
||||||
PKG_CHECK_MODULES([BDW_GC], [bdw-gc])
|
|
||||||
boehmgc_lib="-L$boehmgc/lib -lgc"
|
|
||||||
CXXFLAGS="$BDW_GC_CFLAGS $CXXFLAGS"
|
|
||||||
AC_DEFINE(HAVE_BOEHMGC, 1, [Whether to use the Boehm garbage collector.])
|
|
||||||
fi
|
|
||||||
AC_SUBST(boehmgc_lib)
|
|
||||||
|
|
||||||
|
AC_CHECK_LIB(pthread, pthread_mutex_init)
|
||||||
|
|
||||||
AC_ARG_ENABLE(init-state, AC_HELP_STRING([--disable-init-state],
|
AC_ARG_ENABLE(init-state, AC_HELP_STRING([--disable-init-state],
|
||||||
[do not initialise DB etc. in `make install']),
|
[do not initialise DB etc. in `make install']),
|
||||||
@@ -281,21 +148,33 @@ AC_ARG_ENABLE(init-state, AC_HELP_STRING([--disable-init-state],
|
|||||||
AM_CONDITIONAL(INIT_STATE, test "$init_state" = "yes")
|
AM_CONDITIONAL(INIT_STATE, test "$init_state" = "yes")
|
||||||
|
|
||||||
|
|
||||||
# Setuid installations.
|
AC_ARG_ENABLE(setuid, AC_HELP_STRING([--enable-setuid],
|
||||||
AC_CHECK_FUNCS([setresuid setreuid lchown])
|
[install Nix setuid]),
|
||||||
|
setuid_hack=$enableval, setuid_hack=no)
|
||||||
|
AM_CONDITIONAL(SETUID_HACK, test "$setuid_hack" = "yes")
|
||||||
# Nice to have, but not essential.
|
if test "$setuid_hack" = "yes"; then
|
||||||
AC_CHECK_FUNCS([strsignal posix_fallocate nanosleep])
|
AC_DEFINE(SETUID_HACK, 1, [whether to install Nix setuid])
|
||||||
|
|
||||||
|
|
||||||
# This is needed if ATerm or bzip2 are static libraries,
|
|
||||||
# and the Nix libraries are dynamic.
|
|
||||||
if test "$(uname)" = "Darwin"; then
|
|
||||||
LDFLAGS="-all_load $LDFLAGS"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_FUNC(setresuid, [HAVE_SETRESUID=1], [HAVE_SETRESUID=])
|
||||||
|
AM_CONDITIONAL(HAVE_SETRESUID, test "$HAVE_SETRESUID" = "1")
|
||||||
|
if test "$HAVE_SETRESUID" = "1"; then
|
||||||
|
AC_DEFINE(HAVE_SETRESUID, 1, [whether we have setresuid()])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_ARG_WITH(nix-user, AC_HELP_STRING([--with-nix-user=USER],
|
||||||
|
[user for Nix setuid binaries]),
|
||||||
|
NIX_USER=$withval, NIX_USER=nix)
|
||||||
|
AC_SUBST(NIX_USER)
|
||||||
|
AC_DEFINE_UNQUOTED(NIX_USER, ["$NIX_USER"], [Nix user])
|
||||||
|
|
||||||
|
AC_ARG_WITH(nix-group, AC_HELP_STRING([--with-nix-group=USER],
|
||||||
|
[group for Nix setuid binaries]),
|
||||||
|
NIX_GROUP=$withval, NIX_GROUP=nix)
|
||||||
|
AC_SUBST(NIX_GROUP)
|
||||||
|
AC_DEFINE_UNQUOTED(NIX_GROUP, ["$NIX_GROUP"], [Nix group])
|
||||||
|
|
||||||
|
|
||||||
AM_CONFIG_HEADER([config.h])
|
AM_CONFIG_HEADER([config.h])
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
externals/Makefile
|
externals/Makefile
|
||||||
@@ -311,10 +190,8 @@ AC_CONFIG_FILES([Makefile
|
|||||||
src/libexpr/Makefile
|
src/libexpr/Makefile
|
||||||
src/nix-instantiate/Makefile
|
src/nix-instantiate/Makefile
|
||||||
src/nix-env/Makefile
|
src/nix-env/Makefile
|
||||||
src/nix-worker/Makefile
|
src/log2xml/Makefile
|
||||||
src/nix-setuid-helper/Makefile
|
src/bsdiff-4.2/Makefile
|
||||||
src/nix-log2xml/Makefile
|
|
||||||
src/bsdiff-4.3/Makefile
|
|
||||||
scripts/Makefile
|
scripts/Makefile
|
||||||
corepkgs/Makefile
|
corepkgs/Makefile
|
||||||
corepkgs/nar/Makefile
|
corepkgs/nar/Makefile
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ all-local: builder.pl
|
|||||||
install-exec-local:
|
install-exec-local:
|
||||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
|
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
|
||||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
|
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
|
||||||
$(INSTALL_DATA) $(srcdir)/default.nix $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
|
$(INSTALL_DATA) default.nix $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
|
||||||
$(INSTALL_PROGRAM) builder.pl $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
|
$(INSTALL_PROGRAM) builder.pl $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
|
||||||
|
|
||||||
include ../../substitute.mk
|
include ../../substitute.mk
|
||||||
|
|||||||
@@ -10,17 +10,11 @@ my $out = $ENV{"out"};
|
|||||||
mkdir "$out", 0755 || die "error creating $out";
|
mkdir "$out", 0755 || die "error creating $out";
|
||||||
|
|
||||||
|
|
||||||
my $symlinks = 0;
|
|
||||||
|
|
||||||
my %priorities;
|
|
||||||
|
|
||||||
|
|
||||||
# For each activated package, create symlinks.
|
# For each activated package, create symlinks.
|
||||||
|
|
||||||
sub createLinks {
|
sub createLinks {
|
||||||
my $srcDir = shift;
|
my $srcDir = shift;
|
||||||
my $dstDir = shift;
|
my $dstDir = shift;
|
||||||
my $priority = shift;
|
|
||||||
|
|
||||||
my @srcFiles = glob("$srcDir/*");
|
my @srcFiles = glob("$srcDir/*");
|
||||||
|
|
||||||
@@ -28,20 +22,10 @@ sub createLinks {
|
|||||||
my $baseName = $srcFile;
|
my $baseName = $srcFile;
|
||||||
$baseName =~ s/^.*\///g; # strip directory
|
$baseName =~ s/^.*\///g; # strip directory
|
||||||
my $dstFile = "$dstDir/$baseName";
|
my $dstFile = "$dstDir/$baseName";
|
||||||
|
|
||||||
# The files below are special-cased so that they don't show up
|
if ($srcFile =~ /\/propagated-build-inputs$/ ||
|
||||||
# in user profiles, either because they are useless, or
|
|
||||||
# because they would cause pointless collisions (e.g., each
|
|
||||||
# Python package brings its own
|
|
||||||
# `$out/lib/pythonX.Y/site-packages/easy-install.pth'.)
|
|
||||||
# Urgh, hacky...
|
|
||||||
if ($srcFile =~ /\/propagated-build-inputs$/ ||
|
|
||||||
$srcFile =~ /\/nix-support$/ ||
|
$srcFile =~ /\/nix-support$/ ||
|
||||||
$srcFile =~ /\/perllocal.pod$/ ||
|
$srcFile =~ /\/perllocal.pod$/ ||
|
||||||
$srcFile =~ /\/easy-install.pth$/ ||
|
|
||||||
$srcFile =~ /\/site.py$/ ||
|
|
||||||
$srcFile =~ /\/site.pyc$/ ||
|
|
||||||
$srcFile =~ /\/info\/dir$/ ||
|
|
||||||
$srcFile =~ /\/log$/)
|
$srcFile =~ /\/log$/)
|
||||||
{
|
{
|
||||||
# Do nothing.
|
# Do nothing.
|
||||||
@@ -52,7 +36,7 @@ sub createLinks {
|
|||||||
lstat $dstFile;
|
lstat $dstFile;
|
||||||
|
|
||||||
if (-d _) {
|
if (-d _) {
|
||||||
createLinks($srcFile, $dstFile, $priority);
|
createLinks($srcFile, $dstFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif (-l _) {
|
elsif (-l _) {
|
||||||
@@ -63,109 +47,62 @@ sub createLinks {
|
|||||||
unlink $dstFile or die "error unlinking `$dstFile': $!";
|
unlink $dstFile or die "error unlinking `$dstFile': $!";
|
||||||
mkdir $dstFile, 0755 ||
|
mkdir $dstFile, 0755 ||
|
||||||
die "error creating directory `$dstFile': $!";
|
die "error creating directory `$dstFile': $!";
|
||||||
createLinks($target, $dstFile, $priorities{$dstFile});
|
createLinks($target, $dstFile);
|
||||||
createLinks($srcFile, $dstFile, $priority);
|
createLinks($srcFile, $dstFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
symlink($srcFile, $dstFile) ||
|
symlink($srcFile, $dstFile) ||
|
||||||
die "error creating link `$dstFile': $!";
|
die "error creating link `$dstFile': $!";
|
||||||
$priorities{$dstFile} = $priority;
|
|
||||||
$symlinks++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
elsif (-l $dstFile) {
|
||||||
|
my $target = readlink $dstFile;
|
||||||
|
die "collission between `$srcFile' and `$target'";
|
||||||
|
}
|
||||||
|
|
||||||
if (-l $dstFile) {
|
else {
|
||||||
my $target = readlink $dstFile;
|
# print "linking $dstFile to $srcFile\n";
|
||||||
my $prevPriority = $priorities{$dstFile};
|
|
||||||
die ( "Collission between `$srcFile' and `$target'. "
|
|
||||||
. "Suggested solution: use `nix-env --set-flag "
|
|
||||||
. "priority NUMBER PKGNAME' to change the priority of "
|
|
||||||
. "one of the conflicting packages.\n" )
|
|
||||||
if $prevPriority == $priority;
|
|
||||||
next if $prevPriority < $priority;
|
|
||||||
unlink $dstFile or die;
|
|
||||||
}
|
|
||||||
|
|
||||||
symlink($srcFile, $dstFile) ||
|
symlink($srcFile, $dstFile) ||
|
||||||
die "error creating link `$dstFile': $!";
|
die "error creating link `$dstFile': $!";
|
||||||
$priorities{$dstFile} = $priority;
|
|
||||||
$symlinks++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my %done;
|
my %done;
|
||||||
my %postponed;
|
|
||||||
|
|
||||||
sub addPkg;
|
sub addPkg;
|
||||||
sub addPkg {
|
sub addPkg {
|
||||||
my $pkgDir = shift;
|
my $pkgDir = shift;
|
||||||
my $priority = shift;
|
|
||||||
|
|
||||||
return if (defined $done{$pkgDir});
|
return if (defined $done{$pkgDir});
|
||||||
$done{$pkgDir} = 1;
|
$done{$pkgDir} = 1;
|
||||||
|
|
||||||
# print "symlinking $pkgDir\n";
|
print "adding $pkgDir\n";
|
||||||
createLinks("$pkgDir", "$out", $priority);
|
createLinks("$pkgDir", "$out");
|
||||||
|
|
||||||
my $propagatedFN = "$pkgDir/nix-support/propagated-user-env-packages";
|
my $propagatedFN = "$pkgDir/nix-support/propagated-build-inputs";
|
||||||
if (-e $propagatedFN) {
|
if (-e $propagatedFN) {
|
||||||
open PROP, "<$propagatedFN" or die;
|
open PROP, "<$propagatedFN" or die;
|
||||||
my $propagated = <PROP>;
|
my $propagated = <PROP>;
|
||||||
close PROP;
|
close PROP;
|
||||||
my @propagated = split ' ', $propagated;
|
my @propagated = split ' ', $propagated;
|
||||||
foreach my $p (@propagated) {
|
foreach my $p (@propagated) {
|
||||||
$postponed{$p} = 1 unless defined $done{$p};
|
addPkg $p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Convert the stuff we get from the environment back into a coherent
|
my @args = split ' ', $ENV{"derivations"};
|
||||||
# data type.
|
|
||||||
my @paths = split ' ', $ENV{"paths"};
|
|
||||||
my @active = split ' ', $ENV{"active"};
|
|
||||||
my @priority = split ' ', $ENV{"priority"};
|
|
||||||
|
|
||||||
die if scalar @paths != scalar @active;
|
while (scalar @args > 0) {
|
||||||
die if scalar @paths != scalar @priority;
|
my $drvPath = shift @args;
|
||||||
|
addPkg($drvPath);
|
||||||
my %pkgs;
|
|
||||||
|
|
||||||
for (my $n = 0; $n < scalar @paths; $n++) {
|
|
||||||
$pkgs{$paths[$n]} =
|
|
||||||
{ active => $active[$n]
|
|
||||||
, priority => $priority[$n] };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Symlink to the packages that have been installed explicitly by the
|
symlink($ENV{"manifest"}, "$out/manifest") or die "cannot create manifest";
|
||||||
# user.
|
|
||||||
foreach my $pkg (sort (keys %pkgs)) {
|
|
||||||
#print $pkg, " ", $pkgs{$pkg}->{priority}, "\n";
|
|
||||||
addPkg($pkg, $pkgs{$pkg}->{priority}) if $pkgs{$pkg}->{active} ne "false";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Symlink to the packages that have been "propagated" by packages
|
|
||||||
# installed by the user (i.e., package X declares that it want Y
|
|
||||||
# installed as well). We do these later because they have a lower
|
|
||||||
# priority in case of collisions.
|
|
||||||
my $priorityCounter = 1000; # don't care about collisions
|
|
||||||
while (scalar(keys %postponed) > 0) {
|
|
||||||
my @pkgDirs = keys %postponed;
|
|
||||||
%postponed = ();
|
|
||||||
foreach my $pkgDir (sort @pkgDirs) {
|
|
||||||
addPkg($pkgDir, $priorityCounter++);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print STDERR "created $symlinks symlinks in user environment\n";
|
|
||||||
|
|
||||||
|
|
||||||
symlink($ENV{"manifest"}, "$out/manifest.nix") or die "cannot create manifest";
|
|
||||||
@@ -4,15 +4,6 @@ derivation {
|
|||||||
name = "user-environment";
|
name = "user-environment";
|
||||||
system = system;
|
system = system;
|
||||||
builder = ./builder.pl;
|
builder = ./builder.pl;
|
||||||
|
derivations = derivations;
|
||||||
manifest = manifest;
|
manifest = manifest;
|
||||||
|
|
||||||
# !!! grmbl, need structured data for passing this in a clean way.
|
|
||||||
paths = derivations;
|
|
||||||
active = map (x: if x ? meta && x.meta ? active then x.meta.active else "true") derivations;
|
|
||||||
priority = map (x: if x ? meta && x.meta ? priority then x.meta.priority else "5") derivations;
|
|
||||||
|
|
||||||
# Building user environments remotely just causes huge amounts of
|
|
||||||
# network traffic, so don't do that.
|
|
||||||
preferLocalBuild = true;
|
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ all-local: unpack.sh
|
|||||||
install-exec-local:
|
install-exec-local:
|
||||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
|
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
|
||||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/channels
|
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/channels
|
||||||
$(INSTALL_DATA) $(srcdir)/unpack.nix $(DESTDIR)$(datadir)/nix/corepkgs/channels
|
$(INSTALL_DATA) unpack.nix $(DESTDIR)$(datadir)/nix/corepkgs/channels
|
||||||
$(INSTALL_PROGRAM) unpack.sh $(DESTDIR)$(datadir)/nix/corepkgs/channels
|
$(INSTALL_PROGRAM) unpack.sh $(DESTDIR)$(datadir)/nix/corepkgs/channels
|
||||||
|
|
||||||
include ../../substitute.mk
|
include ../../substitute.mk
|
||||||
|
|||||||
@@ -1,35 +1,22 @@
|
|||||||
#! @shell@ -e
|
#! @shell@ -e
|
||||||
|
|
||||||
# Cygwin compatibility hack: bunzip2 expects cygwin.dll in $PATH.
|
|
||||||
export PATH=@coreutils@
|
|
||||||
|
|
||||||
@coreutils@/mkdir $out
|
@coreutils@/mkdir $out
|
||||||
@coreutils@/mkdir $out/tmp
|
@coreutils@/mkdir $out/tmp
|
||||||
cd $out/tmp
|
cd $out/tmp
|
||||||
|
|
||||||
inputs=($inputs)
|
expr=$out/default.nix
|
||||||
for ((n = 0; n < ${#inputs[*]}; n += 2)); do
|
echo '[' > $expr
|
||||||
channelName=${inputs[n]}
|
|
||||||
channelTarball=${inputs[n+1]}
|
|
||||||
|
|
||||||
echo "unpacking channel $channelName"
|
|
||||||
|
|
||||||
@bunzip2@ < $channelTarball | @tar@ xf -
|
|
||||||
|
|
||||||
if test -e */channel-name; then
|
nr=0
|
||||||
channelName="$(@coreutils@/cat */channel-name)"
|
for i in $inputs; do
|
||||||
fi
|
echo "unpacking $i"
|
||||||
|
@bunzip2@ < $i | @tar@ xvf -
|
||||||
nr=1
|
@coreutils@/mv * ../$nr # !!! hacky
|
||||||
attrName=$(echo $channelName | @tr@ -- '- ' '__')
|
echo "(import ./$nr)" >> $expr
|
||||||
dirName=$attrName
|
nr=$(($nr + 1))
|
||||||
while test -e ../$dirName; do
|
|
||||||
nr=$((nr+1))
|
|
||||||
dirName=$attrName-$nr
|
|
||||||
done
|
|
||||||
|
|
||||||
@coreutils@/mv * ../$dirName # !!! hacky
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo ']' >> $expr
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
@coreutils@/rmdir tmp
|
@coreutils@/rmdir tmp
|
||||||
@@ -3,7 +3,7 @@ all-local: nar.sh
|
|||||||
install-exec-local:
|
install-exec-local:
|
||||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
|
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
|
||||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/nar
|
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/nar
|
||||||
$(INSTALL_DATA) $(srcdir)/nar.nix $(DESTDIR)$(datadir)/nix/corepkgs/nar
|
$(INSTALL_DATA) nar.nix $(DESTDIR)$(datadir)/nix/corepkgs/nar
|
||||||
$(INSTALL_PROGRAM) nar.sh $(DESTDIR)$(datadir)/nix/corepkgs/nar
|
$(INSTALL_PROGRAM) nar.sh $(DESTDIR)$(datadir)/nix/corepkgs/nar
|
||||||
|
|
||||||
include ../../substitute.mk
|
include ../../substitute.mk
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
{system, storePath, hashAlgo}:
|
{system, path, hashAlgo}: derivation {
|
||||||
|
|
||||||
derivation {
|
|
||||||
name = "nar";
|
name = "nar";
|
||||||
builder = ./nar.sh;
|
builder = ./nar.sh;
|
||||||
inherit system storePath hashAlgo;
|
inherit system path hashAlgo;
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
#! @shell@ -e
|
#! @shell@ -e
|
||||||
|
|
||||||
echo "packing $storePath into $out..."
|
echo "packing $path into $out..."
|
||||||
@coreutils@/mkdir $out
|
@coreutils@/mkdir $out
|
||||||
dst=$out/tmp.nar.bz2
|
dst=$out/tmp.nar.bz2
|
||||||
@bindir@/nix-store --dump "$storePath" > tmp
|
@bindir@/nix-store --dump "$path" > tmp
|
||||||
|
|
||||||
@bzip2@ < tmp > $dst
|
@bzip2@ < tmp > $dst
|
||||||
|
|
||||||
|
@bindir@/nix-hash -vvvvv --flat --type $hashAlgo --base32 tmp > $out/nar-hash
|
||||||
|
|
||||||
@bindir@/nix-hash --flat --type $hashAlgo --base32 $dst > $out/narbz2-hash
|
@bindir@/nix-hash --flat --type $hashAlgo --base32 $dst > $out/narbz2-hash
|
||||||
|
|
||||||
@coreutils@/mv $out/tmp.nar.bz2 $out/$(@coreutils@/cat $out/narbz2-hash).nar.bz2
|
@coreutils@/mv $out/tmp.nar.bz2 $out/$(@coreutils@/cat $out/narbz2-hash).nar.bz2
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
To produce a `stable' release from the trunk:
|
To produce a `stable' release from the trunk:
|
||||||
|
|
||||||
-1. Update the release notes; make sure that the release date is
|
|
||||||
correct.
|
|
||||||
|
|
||||||
0. Make sure that the trunk builds in the release supervisor.
|
0. Make sure that the trunk builds in the release supervisor.
|
||||||
|
|
||||||
1. Branch the trunk, e.g., `svn cp .../trunk
|
1. Branch the trunk, e.g., `svn cp .../trunk
|
||||||
@@ -25,8 +22,8 @@ To produce a `stable' release from the trunk:
|
|||||||
branch (e.g., `.../branches/0.5') should be created from the
|
branch (e.g., `.../branches/0.5') should be created from the
|
||||||
original revision of the trunk (since maintenance releases should
|
original revision of the trunk (since maintenance releases should
|
||||||
also be tested first; hence, we cannot have `STABLE=1'). The same
|
also be tested first; hence, we cannot have `STABLE=1'). The same
|
||||||
procedure can then be followed to produce maintenance releases;
|
procedure can then be followed to produce maintenance release; just
|
||||||
just substitute `.../branches/VERSION' for the trunk.
|
substitute `.../branches/VERSION' for the trunk.
|
||||||
|
|
||||||
7. Switch back to the trunk.
|
7. Switch back to the trunk.
|
||||||
|
|
||||||
|
|||||||
+21
-63
@@ -1,42 +1,30 @@
|
|||||||
XMLLINT = $(xmllint) $(xmlflags)
|
ENV = SGML_CATALOG_FILES=$(docbookcatalog)
|
||||||
XSLTPROC = $(xsltproc) $(xmlflags) \
|
|
||||||
|
XMLLINT = $(ENV) $(xmllint) $(xmlflags) --catalogs
|
||||||
|
XSLTPROC = $(ENV) $(xsltproc) $(xmlflags) --catalogs \
|
||||||
--param section.autolabel 1 \
|
--param section.autolabel 1 \
|
||||||
--param section.label.includes.component.label 1 \
|
--param section.label.includes.component.label 1 \
|
||||||
--param html.stylesheet \'style.css\' \
|
--param html.stylesheet \'style.css\' \
|
||||||
--param xref.with.number.and.title 1 \
|
--param xref.with.number.and.title 1 \
|
||||||
--param toc.section.depth 3 \
|
--param toc.section.depth 3
|
||||||
--param admon.style \'\' \
|
|
||||||
--param callout.graphics.extension \'.gif\' \
|
|
||||||
--param contrib.inline.enabled 0
|
|
||||||
|
|
||||||
dblatex_opts = \
|
|
||||||
-P doc.collab.show=0 \
|
|
||||||
-P latex.output.revhistory=0
|
|
||||||
|
|
||||||
# Note: we use GIF for now, since the PNGs shipped with Docbook aren't
|
|
||||||
# transparent.
|
|
||||||
|
|
||||||
man1_MANS = nix-env.1 nix-build.1 nix-store.1 nix-instantiate.1 \
|
man1_MANS = nix-env.1 nix-build.1 nix-store.1 nix-instantiate.1 \
|
||||||
nix-collect-garbage.1 nix-push.1 nix-pull.1 \
|
nix-collect-garbage.1 nix-push.1 nix-pull.1 \
|
||||||
nix-prefetch-url.1 nix-channel.1 \
|
nix-prefetch-url.1 nix-channel.1
|
||||||
nix-install-package.1 nix-hash.1 nix-copy-closure.1
|
|
||||||
|
|
||||||
man8_MANS = nix-worker.8
|
|
||||||
|
|
||||||
FIGURES = figures/user-environments.png
|
FIGURES = figures/user-environments.png
|
||||||
|
|
||||||
MANUAL_SRCS = manual.xml introduction.xml installation.xml \
|
MANUAL_SRCS = manual.xml introduction.xml installation.xml \
|
||||||
package-management.xml writing-nix-expressions.xml builtins.xml \
|
package-management.xml writing-nix-expressions.xml \
|
||||||
build-farm.xml \
|
build-farm.xml \
|
||||||
$(man1_MANS:.1=.xml) $(man8_MANS:.8=.xml) \
|
$(man1_MANS:.1=.xml) \
|
||||||
troubleshooting.xml bugs.xml opt-common.xml opt-common-syn.xml \
|
troubleshooting.xml bugs.xml opt-common.xml opt-common-syn.xml \
|
||||||
env-common.xml quick-start.xml nix-lang-ref.xml glossary.xml \
|
env-common.xml quick-start.xml nix-lang-ref.xml glossary.xml \
|
||||||
conf-file.xml release-notes.xml \
|
conf-file.xml \
|
||||||
style.css images
|
style.css images
|
||||||
|
|
||||||
# Note: RelaxNG validation requires xmllint >= 2.7.4.
|
|
||||||
manual.is-valid: $(MANUAL_SRCS) version.txt
|
manual.is-valid: $(MANUAL_SRCS) version.txt
|
||||||
$(XMLLINT) --noout --nonet --xinclude --noxincludenode --relaxng $(docbookrng)/docbook.rng $<
|
$(XMLLINT) --xinclude $< | $(XMLLINT) --noout --nonet --valid -
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
version.txt:
|
version.txt:
|
||||||
@@ -49,54 +37,24 @@ manual.html: $(MANUAL_SRCS) manual.is-valid images
|
|||||||
$(XSLTPROC) --nonet --xinclude --output manual.html \
|
$(XSLTPROC) --nonet --xinclude --output manual.html \
|
||||||
$(docbookxsl)/html/docbook.xsl manual.xml
|
$(docbookxsl)/html/docbook.xsl manual.xml
|
||||||
|
|
||||||
manual.pdf: $(MANUAL_SRCS) manual.is-valid images
|
all-local: manual.html
|
||||||
if test "$(dblatex)" != ""; then \
|
|
||||||
$(dblatex) $(dblatex_opts) manual.xml; \
|
|
||||||
else \
|
|
||||||
echo "Please install dblatex and rerun configure."; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
NEWS_OPTS = \
|
|
||||||
--stringparam generate.toc "article nop" \
|
|
||||||
--stringparam section.autolabel.max.depth 0 \
|
|
||||||
--stringparam header.rule 0
|
|
||||||
|
|
||||||
NEWS.html: release-notes.xml
|
|
||||||
$(XSLTPROC) --nonet --xinclude --output $@ $(NEWS_OPTS) \
|
|
||||||
$(docbookxsl)/html/docbook.xsl release-notes.xml
|
|
||||||
|
|
||||||
NEWS.txt: release-notes.xml
|
|
||||||
$(XSLTPROC) --nonet --xinclude quote-literals.xsl release-notes.xml | \
|
|
||||||
$(XSLTPROC) --nonet --output $@.tmp.html $(NEWS_OPTS) \
|
|
||||||
$(docbookxsl)/html/docbook.xsl -
|
|
||||||
LANG=en_US $(w3m) -dump $@.tmp.html > $@
|
|
||||||
rm $@.tmp.html
|
|
||||||
|
|
||||||
|
|
||||||
all-local: manual.html NEWS.html NEWS.txt
|
|
||||||
|
|
||||||
install-data-local: manual.html
|
install-data-local: manual.html
|
||||||
$(INSTALL) -d $(DESTDIR)$(docdir)/manual
|
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/manual
|
||||||
$(INSTALL_DATA) manual.html $(DESTDIR)$(docdir)/manual
|
$(INSTALL_DATA) manual.html $(DESTDIR)$(datadir)/nix/manual
|
||||||
ln -sf manual.html $(DESTDIR)$(docdir)/manual/index.html
|
$(INSTALL_DATA) style.css $(DESTDIR)$(datadir)/nix/manual
|
||||||
$(INSTALL_DATA) style.css $(DESTDIR)$(docdir)/manual
|
cp -r images $(DESTDIR)$(datadir)/nix/manual/images
|
||||||
cp -r images $(DESTDIR)$(docdir)/manual/images
|
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/manual/figures
|
||||||
$(INSTALL) -d $(DESTDIR)$(docdir)/manual/figures
|
$(INSTALL_DATA) $(FIGURES) $(DESTDIR)$(datadir)/nix/manual/figures
|
||||||
$(INSTALL_DATA) $(FIGURES) $(DESTDIR)$(docdir)/manual/figures
|
|
||||||
$(INSTALL) -d $(DESTDIR)$(docdir)/release-notes
|
|
||||||
$(INSTALL_DATA) NEWS.html $(DESTDIR)$(docdir)/release-notes/index.html
|
|
||||||
$(INSTALL_DATA) style.css $(DESTDIR)$(docdir)/release-notes/
|
|
||||||
|
|
||||||
images:
|
images:
|
||||||
mkdir images
|
mkdir images
|
||||||
# cp $(docbookxsl)/images/*.gif images
|
cp $(docbookxsl)/images/*.png images
|
||||||
mkdir images/callouts
|
mkdir images/callouts
|
||||||
cp $(docbookxsl)/images/callouts/*.gif images/callouts
|
cp $(docbookxsl)/images/callouts/*.png images/callouts
|
||||||
chmod -R +w images
|
chmod +w -R images
|
||||||
|
|
||||||
KEEP = manual.html manual.is-valid version.txt $(MANS) NEWS.html NEWS.txt
|
KEEP = manual.html manual.is-valid version.txt $(MANS)
|
||||||
|
|
||||||
EXTRA_DIST = $(MANUAL_SRCS) $(FIGURES) $(KEEP)
|
EXTRA_DIST = $(MANUAL_SRCS) $(FIGURES) $(KEEP)
|
||||||
|
|
||||||
|
|||||||
+12
-5
@@ -1,8 +1,4 @@
|
|||||||
<appendix xmlns="http://docbook.org/ns/docbook"
|
<appendix><title>Bugs / To-Do</title>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
|
|
||||||
<title>Bugs / To-Do</title>
|
|
||||||
|
|
||||||
|
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
|
|
||||||
@@ -15,6 +11,17 @@ generation 43 is created which is a descendant of 39, not 42. So a
|
|||||||
rollback from 43 ought to go back to 39. This is not currently
|
rollback from 43 ought to go back to 39. This is not currently
|
||||||
implemented; generations form a linear sequence.</para></listitem>
|
implemented; generations form a linear sequence.</para></listitem>
|
||||||
|
|
||||||
|
<listitem><para><emphasis>Build management.</emphasis> In principle it
|
||||||
|
is already possible to do build management using Nix (by writing
|
||||||
|
builders that perform appropriate build steps), but the Nix expression
|
||||||
|
language is not yet powerful enough to make this pleasant (?). The
|
||||||
|
language should be extended with features from the <ulink
|
||||||
|
url='http://www.cs.uu.nl/~eelco/maak/'>Maak build manager</ulink>.
|
||||||
|
Another interesting idea is to write a <command>make</command>
|
||||||
|
implementation that uses Nix as a back-end to support <ulink
|
||||||
|
url='http://www.research.att.com/~bs/bs_faq.html#legacy'>legacy</ulink>
|
||||||
|
build files.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>For security, <command>nix-push</command> manifests
|
<listitem><para>For security, <command>nix-push</command> manifests
|
||||||
should be digitally signed, and <command>nix-pull</command> should
|
should be digitally signed, and <command>nix-pull</command> should
|
||||||
verify the signatures. The actual NAR archives in the cache do not
|
verify the signatures. The actual NAR archives in the cache do not
|
||||||
|
|||||||
+11
-16
@@ -1,9 +1,4 @@
|
|||||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
<chapter id='chap-build-farm'><title>Setting up a Build Farm</title>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xml:id='chap-build-farm'>
|
|
||||||
|
|
||||||
<title>Setting up a Build Farm</title>
|
|
||||||
|
|
||||||
|
|
||||||
<para>This chapter provides some sketchy information on how to set up
|
<para>This chapter provides some sketchy information on how to set up
|
||||||
a Nix-based build farm. Nix is particularly suited as a basis for a
|
a Nix-based build farm. Nix is particularly suited as a basis for a
|
||||||
@@ -36,10 +31,10 @@ build farm, since:
|
|||||||
builds, and Nix expressions are self-contained.</para></listitem>
|
builds, and Nix expressions are self-contained.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>Nix will only rebuild things that have actually
|
<listitem><para>Nix will only rebuild things that have actually
|
||||||
changed. For instance, if the sources of a package haven't changed
|
changed. For instance, if the sources of a component haven't
|
||||||
between runs of the build farm, the package won't be rebuilt (unless
|
changed between runs of the build farm, the component won't be
|
||||||
it was garbage-collected). Also, dependencies typically don't
|
rebuild (unless it was garbage-collected). Also, dependencies
|
||||||
change very often, so they only need to be built
|
typically don't change very often, so they only need to be built
|
||||||
once.</para></listitem>
|
once.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>The results of a Nix build farm can be made
|
<listitem><para>The results of a Nix build farm can be made
|
||||||
@@ -55,13 +50,13 @@ build farm, since:
|
|||||||
|
|
||||||
<para>TODO</para>
|
<para>TODO</para>
|
||||||
|
|
||||||
<para>The sources of the Nix build farm are at <link
|
<para>The sources of the Nix build farm are at <ulink
|
||||||
xlink:href='https://svn.nixos.org/repos/nix/release/trunk'/>.</para>
|
url='https://svn.cs.uu.nl:12443/repos/trace/release/trunk' />.</para>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
<section xml:id='sec-distributed-builds'><title>Setting up distributed builds</title>
|
<section id='sec-distributed-builds'><title>Setting up distributed builds</title>
|
||||||
|
|
||||||
<para>You can enable distributed builds by setting the environment
|
<para>You can enable distributed builds by setting the environment
|
||||||
variable <envar>NIX_BUILD_HOOK</envar> to point to a program that Nix
|
variable <envar>NIX_BUILD_HOOK</envar> to point to a program that Nix
|
||||||
@@ -75,7 +70,7 @@ the documentation of the <link
|
|||||||
linkend="envar-build-hook"><envar>NIX_BUILD_HOOK</envar>
|
linkend="envar-build-hook"><envar>NIX_BUILD_HOOK</envar>
|
||||||
variable</link>.</para>
|
variable</link>.</para>
|
||||||
|
|
||||||
<example xml:id='ex-remote-systems'><title>Remote machine configuration:
|
<example id='ex-remote-systems'><title>Remote machine configuration:
|
||||||
<filename>remote-systems.conf</filename></title>
|
<filename>remote-systems.conf</filename></title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
nix@mcflurry.labs.cs.uu.nl powerpc-darwin /home/nix/.ssh/id_quarterpounder_auto 2
|
nix@mcflurry.labs.cs.uu.nl powerpc-darwin /home/nix/.ssh/id_quarterpounder_auto 2
|
||||||
@@ -84,8 +79,8 @@ nix@scratchy.labs.cs.uu.nl i686-linux /home/nix/.ssh/id_scratchy_auto
|
|||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>An example build hook can be found in the Nix build farm
|
<para>An example build hook can be found in the Nix build farm
|
||||||
sources: <link
|
sources: <ulink
|
||||||
xlink:href='https://svn.nixos.org/repos/nix/release/trunk/common/distributed/build-remote.pl'
|
url='https://svn.cs.uu.nl:12443/repos/trace/release/trunk/common/distributed/build-remote.pl'
|
||||||
/>. It should be suitable for most purposes, with maybe some minor
|
/>. It should be suitable for most purposes, with maybe some minor
|
||||||
adjustments. It uses <command>ssh</command> and
|
adjustments. It uses <command>ssh</command> and
|
||||||
<command>rsync</command> to copy the build inputs and outputs and
|
<command>rsync</command> to copy the build inputs and outputs and
|
||||||
|
|||||||
@@ -1,851 +0,0 @@
|
|||||||
<section xmlns="http://docbook.org/ns/docbook"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xml:id='ssec-builtins'>
|
|
||||||
|
|
||||||
<title>Built-in functions</title>
|
|
||||||
|
|
||||||
|
|
||||||
<para>This section lists the functions and constants built into the
|
|
||||||
Nix expression evaluator. (The built-in function
|
|
||||||
<function>derivation</function> is discussed above.) Some built-ins,
|
|
||||||
such as <function>derivation</function>, are always in scope of every
|
|
||||||
Nix expression; you can just access them right away. But to prevent
|
|
||||||
polluting the namespace too much, most built-ins are not in scope.
|
|
||||||
Instead, you can access them through the <varname>builtins</varname>
|
|
||||||
built-in value, which is an attribute set that contains all built-in
|
|
||||||
functions and values. For instance, <function>derivation</function>
|
|
||||||
is also available as <function>builtins.derivation</function>.</para>
|
|
||||||
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>abort</function> <replaceable>s</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Abort Nix expression evaluation, print error
|
|
||||||
message <replaceable>s</replaceable>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.add</function>
|
|
||||||
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the sum of the integers
|
|
||||||
<replaceable>e1</replaceable> and
|
|
||||||
<replaceable>e2</replaceable>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.attrNames</function>
|
|
||||||
<replaceable>attrs</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the names of the attributes in the
|
|
||||||
attribute set <replaceable>attrs</replaceable> in a sorted list.
|
|
||||||
For instance, <literal>builtins.attrNames {y = 1; x =
|
|
||||||
"foo";}</literal> evaluates to <literal>["x" "y"]</literal>.
|
|
||||||
There is no built-in function <function>attrValues</function>, but
|
|
||||||
you can easily define it yourself:
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
attrValues = attrs: map (name: builtins.getAttr name attrs) (builtins.attrNames attrs);</programlisting>
|
|
||||||
|
|
||||||
</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>baseNameOf</function> <replaceable>s</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the <emphasis>base name</emphasis> of the
|
|
||||||
string <replaceable>s</replaceable>, that is, everything following
|
|
||||||
the final slash in the string. This is similar to the GNU
|
|
||||||
<command>basename</command> command.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><varname>builtins</varname></term>
|
|
||||||
|
|
||||||
<listitem><para>The attribute set <varname>builtins</varname>
|
|
||||||
contains all the built-in functions and values. You can use
|
|
||||||
<varname>builtins</varname> to test for the availability of
|
|
||||||
features in the Nix installation, e.g.,
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
if builtins ? getEnv then builtins.getEnv "PATH" else ""</programlisting>
|
|
||||||
|
|
||||||
This allows a Nix expression to fall back gracefully on older Nix
|
|
||||||
installations that don’t have the desired built-in
|
|
||||||
function.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.compareVersions</function>
|
|
||||||
<replaceable>s1</replaceable> <replaceable>s2</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Compare two strings representing versions and
|
|
||||||
return <literal>-1</literal> if version
|
|
||||||
<replaceable>s1</replaceable> is older than version
|
|
||||||
<replaceable>s2</replaceable>, <literal>0</literal> if they are
|
|
||||||
the same, and <literal>1</literal> if
|
|
||||||
<replaceable>s1</replaceable> is newer than
|
|
||||||
<replaceable>s2</replaceable>. The version comparison algorithm
|
|
||||||
is the same as the one used by <link
|
|
||||||
linkend="ssec-version-comparisons"><command>nix-env
|
|
||||||
-u</command></link>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry
|
|
||||||
xml:id='builtin-currentSystem'><term><varname>builtins.currentSystem</varname></term>
|
|
||||||
|
|
||||||
<listitem><para>The built-in value <varname>currentSystem</varname>
|
|
||||||
evaluates to the Nix platform identifier for the Nix installation
|
|
||||||
on which the expression is being evaluated, such as
|
|
||||||
<literal>"i686-linux"</literal> or
|
|
||||||
<literal>"powerpc-darwin"</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<varlistentry><term><function>currentTime</function></term>
|
|
||||||
|
|
||||||
<listitem><para>The built-in value <varname>currentTime</varname>
|
|
||||||
returns the current system time in seconds since 00:00:00 1/1/1970
|
|
||||||
UTC. Due to the evaluation model of Nix expressions
|
|
||||||
(<emphasis>maximal laziness</emphasis>), it always yields the same
|
|
||||||
value within an execution of Nix.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<varlistentry><term><function>dependencyClosure</function></term>
|
|
||||||
|
|
||||||
<listitem><para>TODO</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>derivation</function>
|
|
||||||
<replaceable>attrs</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para><function>derivation</function> is described in
|
|
||||||
<xref linkend='ssec-derivation' />.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>dirOf</function> <replaceable>s</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the directory part of the string
|
|
||||||
<replaceable>s</replaceable>, that is, everything before the final
|
|
||||||
slash in the string. This is similar to the GNU
|
|
||||||
<command>dirname</command> command.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.div</function>
|
|
||||||
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the quotient of the integers
|
|
||||||
<replaceable>e1</replaceable> and
|
|
||||||
<replaceable>e2</replaceable>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.filterSource</function>
|
|
||||||
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
|
|
||||||
<para>This function allows you to copy sources into the Nix
|
|
||||||
store while filtering certain files. For instance, suppose that
|
|
||||||
you want to use the directory <filename>source-dir</filename> as
|
|
||||||
an input to a Nix expression, e.g.
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
...
|
|
||||||
src = ./source-dir;
|
|
||||||
}
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
However, if <filename>source-dir</filename> is a Subversion
|
|
||||||
working copy, then all those annoying <filename>.svn</filename>
|
|
||||||
subdirectories will also be copied to the store. Worse, the
|
|
||||||
contents of those directories may change a lot, causing lots of
|
|
||||||
spurious rebuilds. With <function>filterSource</function> you
|
|
||||||
can filter out the <filename>.svn</filename> directories:
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
src = builtins.filterSource
|
|
||||||
(path: type: type != "directory" || baseNameOf path != ".svn")
|
|
||||||
./source-dir;
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>Thus, the first argument <replaceable>e1</replaceable>
|
|
||||||
must be a predicate function that is called for each regular
|
|
||||||
file, directory or symlink in the source tree
|
|
||||||
<replaceable>e2</replaceable>. If the function returns
|
|
||||||
<literal>true</literal>, the file is copied to the Nix store,
|
|
||||||
otherwise it is omitted. The function is called with two
|
|
||||||
arguments. The first is the full path of the file. The second
|
|
||||||
is a string that identifies the type of the file, which is
|
|
||||||
either <literal>"regular"</literal>,
|
|
||||||
<literal>"directory"</literal>, <literal>"symlink"</literal> or
|
|
||||||
<literal>"unknown"</literal> (for other kinds of files such as
|
|
||||||
device nodes or fifos — but note that those cannot be copied to
|
|
||||||
the Nix store, so if the predicate returns
|
|
||||||
<literal>true</literal> for them, the copy will fail).</para>
|
|
||||||
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.getAttr</function>
|
|
||||||
<replaceable>s</replaceable> <replaceable>attrs</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para><function>getAttr</function> returns the attribute
|
|
||||||
named <replaceable>s</replaceable> from the attribute set
|
|
||||||
<replaceable>attrs</replaceable>. Evaluation aborts if the
|
|
||||||
attribute doesn’t exist. This is a dynamic version of the
|
|
||||||
<literal>.</literal> operator, since <replaceable>s</replaceable>
|
|
||||||
is an expression rather than an identifier.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.getEnv</function>
|
|
||||||
<replaceable>s</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para><function>getEnv</function> returns the value of
|
|
||||||
the environment variable <replaceable>s</replaceable>, or an empty
|
|
||||||
string if the variable doesn’t exist. This function should be
|
|
||||||
used with care, as it can introduce all sorts of nasty environment
|
|
||||||
dependencies in your Nix expression.</para>
|
|
||||||
|
|
||||||
<para><function>getEnv</function> is used in Nix Packages to
|
|
||||||
locate the file <filename>~/.nixpkgs/config.nix</filename>, which
|
|
||||||
contains user-local settings for Nix Packages. (That is, it does
|
|
||||||
a <literal>getEnv "HOME"</literal> to locate the user’s home
|
|
||||||
directory.)</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.hasAttr</function>
|
|
||||||
<replaceable>s</replaceable> <replaceable>attrs</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para><function>hasAttr</function> returns
|
|
||||||
<literal>true</literal> if the attribute set
|
|
||||||
<replaceable>attrs</replaceable> has an attribute named
|
|
||||||
<replaceable>s</replaceable>, and <literal>false</literal>
|
|
||||||
otherwise. This is a dynamic version of the <literal>?</literal>
|
|
||||||
operator, since <replaceable>s</replaceable> is an expression
|
|
||||||
rather than an identifier.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.head</function>
|
|
||||||
<replaceable>list</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the first element of a list; abort
|
|
||||||
evaluation if the argument isn’t a list or is an empty list. You
|
|
||||||
can test whether a list is empty by comparing it with
|
|
||||||
<literal>[]</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>import</function>
|
|
||||||
<replaceable>path</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Load, parse and return the Nix expression in the
|
|
||||||
file <replaceable>path</replaceable>. Evaluation aborts if the
|
|
||||||
file doesn’t exist or contains an incorrect Nix
|
|
||||||
expression. <function>import</function> implements Nix’s module
|
|
||||||
system: you can put any Nix expression (such as an attribute set
|
|
||||||
or a function) in a separate file, and use it from Nix expressions
|
|
||||||
in other files.</para>
|
|
||||||
|
|
||||||
<para>A Nix expression loaded by <function>import</function> must
|
|
||||||
not contain any <emphasis>free variables</emphasis> (identifiers
|
|
||||||
that are not defined in the Nix expression itself and are not
|
|
||||||
built-in). Therefore, it cannot refer to variables that are in
|
|
||||||
scope at the call site. For instance, if you have a calling
|
|
||||||
expression
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
rec {
|
|
||||||
x = 123;
|
|
||||||
y = import ./foo.nix;
|
|
||||||
}</programlisting>
|
|
||||||
|
|
||||||
then the following <filename>foo.nix</filename> will give an
|
|
||||||
error:
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
x + 456</programlisting>
|
|
||||||
|
|
||||||
since <varname>x</varname> is not in scope in
|
|
||||||
<filename>foo.nix</filename>. If you want <varname>x</varname>
|
|
||||||
to be available in <filename>foo.nix</filename>, you should pass
|
|
||||||
it as a function argument:
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
rec {
|
|
||||||
x = 123;
|
|
||||||
y = import ./foo.nix x;
|
|
||||||
}</programlisting>
|
|
||||||
|
|
||||||
and
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
x: x + 456</programlisting>
|
|
||||||
|
|
||||||
(The function argument doesn’t have to be called
|
|
||||||
<varname>x</varname> in <filename>foo.nix</filename>; any name
|
|
||||||
would work.)</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.intersectAttrs</function>
|
|
||||||
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return an attribute set consisting of the
|
|
||||||
attributes in the set <replaceable>e2</replaceable> that also
|
|
||||||
exist in the set <replaceable>e1</replaceable>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.isAttrs</function>
|
|
||||||
<replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return <literal>true</literal> if
|
|
||||||
<replaceable>e</replaceable> evaluates to an attribute set, and
|
|
||||||
<literal>false</literal> otherwise.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.isList</function>
|
|
||||||
<replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return <literal>true</literal> if
|
|
||||||
<replaceable>e</replaceable> evaluates to a list, and
|
|
||||||
<literal>false</literal> otherwise.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.isFunction</function>
|
|
||||||
<replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return <literal>true</literal> if
|
|
||||||
<replaceable>e</replaceable> evaluates to a function, and
|
|
||||||
<literal>false</literal> otherwise.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.isString</function>
|
|
||||||
<replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return <literal>true</literal> if
|
|
||||||
<replaceable>e</replaceable> evaluates to a string, and
|
|
||||||
<literal>false</literal> otherwise.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.isInt</function>
|
|
||||||
<replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return <literal>true</literal> if
|
|
||||||
<replaceable>e</replaceable> evaluates to a int, and
|
|
||||||
<literal>false</literal> otherwise.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.isBool</function>
|
|
||||||
<replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return <literal>true</literal> if
|
|
||||||
<replaceable>e</replaceable> evaluates to a bool, and
|
|
||||||
<literal>false</literal> otherwise.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>isNull</function>
|
|
||||||
<replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return <literal>true</literal> if
|
|
||||||
<replaceable>e</replaceable> evaluates to <literal>null</literal>,
|
|
||||||
and <literal>false</literal> otherwise.</para>
|
|
||||||
|
|
||||||
<warning><para>This function is <emphasis>deprecated</emphasis>;
|
|
||||||
just write <literal>e == null</literal> instead.</para></warning>
|
|
||||||
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.length</function>
|
|
||||||
<replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the length of the list
|
|
||||||
<replaceable>e</replaceable>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.lessThan</function>
|
|
||||||
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return <literal>true</literal> if the integer
|
|
||||||
<replaceable>e1</replaceable> is less than the integer
|
|
||||||
<replaceable>e2</replaceable>, and <literal>false</literal>
|
|
||||||
otherwise. Evaluation aborts if either
|
|
||||||
<replaceable>e1</replaceable> or <replaceable>e2</replaceable>
|
|
||||||
does not evaluate to an integer.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.listToAttrs</function>
|
|
||||||
<replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Construct an attribute set from a list specifying
|
|
||||||
the names and values of each attribute. Each element of the list
|
|
||||||
should be an attribute set consisting of a string-valued attribute
|
|
||||||
<varname>name</varname> specifying the name of the attribute, and
|
|
||||||
an attribute <varname>value</varname> specifying its value.
|
|
||||||
Example:
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
builtins.listToAttrs [
|
|
||||||
{name = "foo"; value = 123;}
|
|
||||||
{name = "bar"; value = 456;}
|
|
||||||
]
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
evaluates to
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
{ foo = 123; bar = 456; }
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><function>map</function>
|
|
||||||
<replaceable>f</replaceable> <replaceable>list</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Apply the function <replaceable>f</replaceable> to
|
|
||||||
each element in the list <replaceable>list</replaceable>. For
|
|
||||||
example,
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
map (x: "foo" + x) ["bar" "bla" "abc"]</programlisting>
|
|
||||||
|
|
||||||
evaluates to <literal>["foobar" "foobla"
|
|
||||||
"fooabc"]</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.mul</function>
|
|
||||||
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the product of the integers
|
|
||||||
<replaceable>e1</replaceable> and
|
|
||||||
<replaceable>e2</replaceable>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.parseDrvName</function>
|
|
||||||
<replaceable>s</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Split the string <replaceable>s</replaceable> into
|
|
||||||
a package name and version. The package name is everything up to
|
|
||||||
but not including the first dash followed by a digit, and the
|
|
||||||
version is everything following that dash. The result is returned
|
|
||||||
in an attribute set <literal>{name, version}</literal>. Thus,
|
|
||||||
<literal>builtins.parseDrvName "nix-0.12pre12876"</literal>
|
|
||||||
returns <literal>{name = "nix"; version =
|
|
||||||
"0.12pre12876";}</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.pathExists</function>
|
|
||||||
<replaceable>path</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return <literal>true</literal> if the path
|
|
||||||
<replaceable>path</replaceable> exists, and
|
|
||||||
<literal>false</literal> otherwise. One application of this
|
|
||||||
function is to conditionally include a Nix expression containing
|
|
||||||
user configuration:
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
let
|
|
||||||
fileName = builtins.getEnv "CONFIG_FILE";
|
|
||||||
config =
|
|
||||||
if fileName != "" && builtins.pathExists (builtins.toPath fileName)
|
|
||||||
then import (builtins.toPath fileName)
|
|
||||||
else { someSetting = false; }; <lineannotation># default configuration</lineannotation>
|
|
||||||
in config.someSetting</programlisting>
|
|
||||||
|
|
||||||
(Note that <envar>CONFIG_FILE</envar> must be an absolute path for
|
|
||||||
this to work.)</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<varlistentry><term><function>relativise</function></term>
|
|
||||||
|
|
||||||
<listitem><para>TODO</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.readFile</function>
|
|
||||||
<replaceable>path</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the contents of the file
|
|
||||||
<replaceable>path</replaceable> as a string.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>removeAttrs</function>
|
|
||||||
<replaceable>attrs</replaceable> <replaceable>list</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Remove the attributes listed in
|
|
||||||
<replaceable>list</replaceable> from the attribute set
|
|
||||||
<replaceable>attrs</replaceable>. The attributes don’t have to
|
|
||||||
exist in <replaceable>attrs</replaceable>. For instance,
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
removeAttrs { x = 1; y = 2; z = 3; } ["a" "x" "z"]</screen>
|
|
||||||
|
|
||||||
evaluates to <literal>{y = 2;}</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.stringLength</function>
|
|
||||||
<replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the length of the string
|
|
||||||
<replaceable>e</replaceable>. If <replaceable>e</replaceable> is
|
|
||||||
not a string, evaluation is aborted.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.sub</function>
|
|
||||||
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the difference between the integers
|
|
||||||
<replaceable>e1</replaceable> and
|
|
||||||
<replaceable>e2</replaceable>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.substring</function>
|
|
||||||
<replaceable>start</replaceable> <replaceable>len</replaceable>
|
|
||||||
<replaceable>s</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the substring of
|
|
||||||
<replaceable>s</replaceable> from character position
|
|
||||||
<replaceable>start</replaceable> (zero-based) up to but not
|
|
||||||
including <replaceable>start + len</replaceable>. If
|
|
||||||
<replaceable>start</replaceable> is greater than the length of the
|
|
||||||
string, an empty string is returned, and if <replaceable>start +
|
|
||||||
len</replaceable> lies beyond the end of the string, only the
|
|
||||||
substring up to the end of the string is returned.
|
|
||||||
<replaceable>start</replaceable> must be
|
|
||||||
non-negative.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.tail</function>
|
|
||||||
<replaceable>list</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return the second to last elements of a list;
|
|
||||||
abort evaluation if the argument isn’t a list or is an empty
|
|
||||||
list.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>throw</function>
|
|
||||||
<replaceable>s</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Throw an error message
|
|
||||||
<replaceable>s</replaceable>. This usually aborts Nix expression
|
|
||||||
evaluation, but in <command>nix-env -qa</command> and other
|
|
||||||
commands that try to evaluate a set of derivations to get
|
|
||||||
information about those derivations, a derivation that throws an
|
|
||||||
error is silently skipped (which is not the case for
|
|
||||||
<function>abort</function>).</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry
|
|
||||||
xml:id='builtin-toFile'><term><function>builtins.toFile</function>
|
|
||||||
<replaceable>name</replaceable> <replaceable>s</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Store the string <replaceable>s</replaceable> in a
|
|
||||||
file in the Nix store and return its path. The file has suffix
|
|
||||||
<replaceable>name</replaceable>. This file can be used as an
|
|
||||||
input to derivations. One application is to write builders
|
|
||||||
“inline”. For instance, the following Nix expression combines
|
|
||||||
<xref linkend='ex-hello-nix' /> and <xref
|
|
||||||
linkend='ex-hello-builder' /> into one file:
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
{stdenv, fetchurl, perl}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "hello-2.1.1";
|
|
||||||
|
|
||||||
builder = builtins.toFile "builder.sh" "
|
|
||||||
source $stdenv/setup
|
|
||||||
|
|
||||||
PATH=$perl/bin:$PATH
|
|
||||||
|
|
||||||
tar xvfz $src
|
|
||||||
cd hello-*
|
|
||||||
./configure --prefix=$out
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
";
|
|
||||||
|
|
||||||
src = fetchurl {
|
|
||||||
url = http://nix.cs.uu.nl/dist/tarballs/hello-2.1.1.tar.gz;
|
|
||||||
md5 = "70c9ccf9fac07f762c24f2df2290784d";
|
|
||||||
};
|
|
||||||
inherit perl;
|
|
||||||
}</programlisting>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>It is even possible for one file to refer to another, e.g.,
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
builder = let
|
|
||||||
configFile = builtins.toFile "foo.conf" "
|
|
||||||
# This is some dummy configuration file.
|
|
||||||
<replaceable>...</replaceable>
|
|
||||||
";
|
|
||||||
in builtins.toFile "builder.sh" "
|
|
||||||
source $stdenv/setup
|
|
||||||
<replaceable>...</replaceable>
|
|
||||||
cp ${configFile} $out/etc/foo.conf
|
|
||||||
";</programlisting>
|
|
||||||
|
|
||||||
Note that <literal>${configFile}</literal> is an antiquotation
|
|
||||||
(see <xref linkend='ssec-values' />), so the result of the
|
|
||||||
expression <literal>configFile</literal> (i.e., a path like
|
|
||||||
<filename>/nix/store/m7p7jfny445k...-foo.conf</filename>) will be
|
|
||||||
spliced into the resulting string.</para>
|
|
||||||
|
|
||||||
<para>It is however <emphasis>not</emphasis> allowed to have files
|
|
||||||
mutually referring to each other, like so:
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
let
|
|
||||||
foo = builtins.toFile "foo" "...${bar}...";
|
|
||||||
bar = builtins.toFile "bar" "...${foo}...";
|
|
||||||
in foo</programlisting>
|
|
||||||
|
|
||||||
This is not allowed because it would cause a cyclic dependency in
|
|
||||||
the computation of the cryptographic hashes for
|
|
||||||
<varname>foo</varname> and <varname>bar</varname>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.toPath</function> <replaceable>s</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Convert the string value
|
|
||||||
<replaceable>s</replaceable> into a path value. The string
|
|
||||||
<replaceable>s</replaceable> must represent an absolute path
|
|
||||||
(i.e., must start with <literal>/</literal>). The path need not
|
|
||||||
exist. The resulting path is canonicalised, e.g.,
|
|
||||||
<literal>builtins.toPath "//foo/xyzzy/../bar/"</literal> returns
|
|
||||||
<literal>/foo/bar</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>toString</function> <replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Convert the expression
|
|
||||||
<replaceable>e</replaceable> to a string.
|
|
||||||
<replaceable>e</replaceable> can be a string (in which case
|
|
||||||
<function>toString</function> is a no-op) or a path (e.g.,
|
|
||||||
<literal>toString /foo/bar</literal> yields
|
|
||||||
<literal>"/foo/bar"</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id='builtin-toXML'><term><function>builtins.toXML</function> <replaceable>e</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Return a string containing an XML representation
|
|
||||||
of <replaceable>e</replaceable>. The main application for
|
|
||||||
<function>toXML</function> is to communicate information with the
|
|
||||||
builder in a more structured format than plain environment
|
|
||||||
variables.</para>
|
|
||||||
|
|
||||||
<!-- TODO: more formally describe the schema of the XML
|
|
||||||
representation -->
|
|
||||||
|
|
||||||
<para><xref linkend='ex-toxml' /> shows an example where this is
|
|
||||||
the case. The builder is supposed to generate the configuration
|
|
||||||
file for a <link xlink:href='http://jetty.mortbay.org/'>Jetty
|
|
||||||
servlet container</link>. A servlet container contains a number
|
|
||||||
of servlets (<filename>*.war</filename> files) each exported under
|
|
||||||
a specific URI prefix. So the servlet configuration is a list of
|
|
||||||
attribute sets containing the <varname>path</varname> and
|
|
||||||
<varname>war</varname> of the servlet (<xref
|
|
||||||
linkend='ex-toxml-co-servlets' />). This kind of information is
|
|
||||||
difficult to communicate with the normal method of passing
|
|
||||||
information through an environment variable, which just
|
|
||||||
concatenates everything together into a string (which might just
|
|
||||||
work in this case, but wouldn’t work if fields are optional or
|
|
||||||
contain lists themselves). Instead the Nix expression is
|
|
||||||
converted to an XML representation with
|
|
||||||
<function>toXML</function>, which is unambiguous and can easily be
|
|
||||||
processed with the appropriate tools. For instance, in the
|
|
||||||
example an XSLT stylesheet (<xref linkend='ex-toxml-co-stylesheet'
|
|
||||||
/>) is applied to it (<xref linkend='ex-toxml-co-apply' />) to
|
|
||||||
generate the XML configuration file for the Jetty server. The XML
|
|
||||||
representation produced from <xref linkend='ex-toxml-co-servlets'
|
|
||||||
/> by <function>toXML</function> is shown in <xref
|
|
||||||
linkend='ex-toxml-result' />.</para>
|
|
||||||
|
|
||||||
<para>Note that <xref linkend='ex-toxml' /> uses the <function
|
|
||||||
linkend='builtin-toFile'>toFile</function> built-in to write the
|
|
||||||
builder and the stylesheet “inline” in the Nix expression. The
|
|
||||||
path of the stylesheet is spliced into the builder at
|
|
||||||
<literal>xsltproc ${stylesheet}
|
|
||||||
<replaceable>...</replaceable></literal>.</para>
|
|
||||||
|
|
||||||
<example xml:id='ex-toxml'><title>Passing information to a builder
|
|
||||||
using <function>toXML</function></title>
|
|
||||||
|
|
||||||
<programlisting><![CDATA[
|
|
||||||
{stdenv, fetchurl, libxslt, jira, uberwiki}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation (rec {
|
|
||||||
name = "web-server";
|
|
||||||
|
|
||||||
buildInputs = [libxslt];
|
|
||||||
|
|
||||||
builder = builtins.toFile "builder.sh" "
|
|
||||||
source $stdenv/setup
|
|
||||||
mkdir $out
|
|
||||||
echo $servlets | xsltproc ${stylesheet} - > $out/server-conf.xml]]> <co xml:id='ex-toxml-co-apply' /> <![CDATA[
|
|
||||||
";
|
|
||||||
|
|
||||||
stylesheet = builtins.toFile "stylesheet.xsl"]]> <co xml:id='ex-toxml-co-stylesheet' /> <![CDATA[
|
|
||||||
"<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
|
|
||||||
<xsl:template match='/'>
|
|
||||||
<Configure>
|
|
||||||
<xsl:for-each select='/expr/list/attrs'>
|
|
||||||
<Call name='addWebApplication'>
|
|
||||||
<Arg><xsl:value-of select=\"attr[@name = 'path']/string/@value\" /></Arg>
|
|
||||||
<Arg><xsl:value-of select=\"attr[@name = 'war']/path/@value\" /></Arg>
|
|
||||||
</Call>
|
|
||||||
</xsl:for-each>
|
|
||||||
</Configure>
|
|
||||||
</xsl:template>
|
|
||||||
</xsl:stylesheet>
|
|
||||||
";
|
|
||||||
|
|
||||||
servlets = builtins.toXML []]> <co xml:id='ex-toxml-co-servlets' /> <![CDATA[
|
|
||||||
{ path = "/bugtracker"; war = jira + "/lib/atlassian-jira.war"; }
|
|
||||||
{ path = "/wiki"; war = uberwiki + "/uberwiki.war"; }
|
|
||||||
];
|
|
||||||
})]]></programlisting>
|
|
||||||
|
|
||||||
</example>
|
|
||||||
|
|
||||||
<example xml:id='ex-toxml-result'><title>XML representation produced by
|
|
||||||
<function>toXML</function></title>
|
|
||||||
|
|
||||||
<programlisting><![CDATA[<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<expr>
|
|
||||||
<list>
|
|
||||||
<attrs>
|
|
||||||
<attr name="path">
|
|
||||||
<string value="/bugtracker" />
|
|
||||||
</attr>
|
|
||||||
<attr name="war">
|
|
||||||
<path value="/nix/store/d1jh9pasa7k2...-jira/lib/atlassian-jira.war" />
|
|
||||||
</attr>
|
|
||||||
</attrs>
|
|
||||||
<attrs>
|
|
||||||
<attr name="path">
|
|
||||||
<string value="/wiki" />
|
|
||||||
</attr>
|
|
||||||
<attr name="war">
|
|
||||||
<path value="/nix/store/y6423b1yi4sx...-uberwiki/uberwiki.war" />
|
|
||||||
</attr>
|
|
||||||
</attrs>
|
|
||||||
</list>
|
|
||||||
</expr>]]></programlisting>
|
|
||||||
|
|
||||||
</example>
|
|
||||||
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.trace</function>
|
|
||||||
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Evaluate <replaceable>e1</replaceable> and print its
|
|
||||||
abstract syntax representation on standard error. Then return
|
|
||||||
<replaceable>e2</replaceable>. This function is useful for
|
|
||||||
debugging.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
|
||||||
+5
-195
@@ -1,9 +1,4 @@
|
|||||||
<section xmlns="http://docbook.org/ns/docbook"
|
<sect1 id="sec-conf-file"><title>Nix configuration file</title>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xml:id="sec-conf-file">
|
|
||||||
|
|
||||||
<title>Nix configuration file</title>
|
|
||||||
|
|
||||||
|
|
||||||
<para>A number of persistent settings of Nix are stored in the file
|
<para>A number of persistent settings of Nix are stored in the file
|
||||||
<filename><replaceable>prefix</replaceable>/etc/nix/nix.conf</filename>.
|
<filename><replaceable>prefix</replaceable>/etc/nix/nix.conf</filename>.
|
||||||
@@ -12,7 +7,7 @@ This file is a list of <literal><replaceable>name</replaceable> =
|
|||||||
Comments start with a <literal>#</literal> character. An example
|
Comments start with a <literal>#</literal> character. An example
|
||||||
configuration file is shown in <xref linkend="ex-nix-conf" />.</para>
|
configuration file is shown in <xref linkend="ex-nix-conf" />.</para>
|
||||||
|
|
||||||
<example xml:id='ex-nix-conf'><title>Nix configuration file</title>
|
<example id='ex-nix-conf'><title>Nix configuration file</title>
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
gc-keep-outputs = true # Nice for developers
|
gc-keep-outputs = true # Nice for developers
|
||||||
@@ -25,8 +20,7 @@ env-keep-derivations = false
|
|||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
|
<varlistentry id="conf-gc-keep-outputs"><term><literal>gc-keep-outputs</literal></term>
|
||||||
<varlistentry xml:id="conf-gc-keep-outputs"><term><literal>gc-keep-outputs</literal></term>
|
|
||||||
|
|
||||||
<listitem><para>If <literal>true</literal>, the garbage collector
|
<listitem><para>If <literal>true</literal>, the garbage collector
|
||||||
will keep the outputs of non-garbage derivations. If
|
will keep the outputs of non-garbage derivations. If
|
||||||
@@ -41,9 +35,8 @@ env-keep-derivations = false
|
|||||||
this option to <literal>true</literal>.</para></listitem>
|
this option to <literal>true</literal>.</para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="conf-gc-keep-derivations"><term><literal>gc-keep-derivations</literal></term>
|
<varlistentry id="conf-gc-keep-derivations"><term><literal>gc-keep-derivations</literal></term>
|
||||||
|
|
||||||
<listitem><para>If <literal>true</literal> (default), the garbage
|
<listitem><para>If <literal>true</literal> (default), the garbage
|
||||||
collector will keep the derivations from which non-garbage store
|
collector will keep the derivations from which non-garbage store
|
||||||
@@ -59,7 +52,6 @@ env-keep-derivations = false
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><literal>env-keep-derivations</literal></term>
|
<varlistentry><term><literal>env-keep-derivations</literal></term>
|
||||||
|
|
||||||
<listitem><para>If <literal>false</literal> (default), derivations
|
<listitem><para>If <literal>false</literal> (default), derivations
|
||||||
@@ -83,190 +75,8 @@ env-keep-derivations = false
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="conf-build-max-jobs"><term><literal>build-max-jobs</literal></term>
|
|
||||||
|
|
||||||
<listitem><para>This option defines the maximum number of jobs
|
|
||||||
that Nix will try to build in parallel. The default is
|
|
||||||
<literal>1</literal>. You should generally set it to the number
|
|
||||||
of CPUs in your system (e.g., <literal>2</literal> on a Athlon 64
|
|
||||||
X2). It can be overriden using the <option
|
|
||||||
linkend='opt-max-jobs'>--max-jobs</option> (<option>-j</option>)
|
|
||||||
command line switch.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="conf-build-cores"><term><literal>build-cores</literal></term>
|
|
||||||
|
|
||||||
<listitem><para>Sets the value of the
|
|
||||||
<envar>NIX_BUILD_CORES</envar> environment variable in the
|
|
||||||
invocation of builders. Builders can use this variable at their
|
|
||||||
discretion to control the maximum amount of parallelism. For
|
|
||||||
instance, in Nixpkgs, if the derivation attribute
|
|
||||||
<varname>enableParallelBuilding</varname> is set to
|
|
||||||
<literal>true</literal>, the builder passes the
|
|
||||||
<option>-j<replaceable>N</replaceable></option> flag to GNU Make.
|
|
||||||
It can be overriden using the <option
|
|
||||||
linkend='opt-cores'>--cores</option> command line switch and
|
|
||||||
defaults to <literal>1</literal>. The value <literal>0</literal>
|
|
||||||
means that the builder should use all available CPU cores in the
|
|
||||||
system.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="conf-build-max-silent-time"><term><literal>build-max-silent-time</literal></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
|
|
||||||
<para>This option defines the maximum number of seconds that a
|
|
||||||
builder can go without producing any data on standard output or
|
|
||||||
standard error. This is useful (for instance in a automated
|
|
||||||
build system) to catch builds that are stuck in an infinite
|
|
||||||
loop, or to catch remote builds that are hanging due to network
|
|
||||||
problems. It can be overriden using the <option
|
|
||||||
linkend="opt-max-silent-time">--max-silent-time</option> command
|
|
||||||
line switch.</para>
|
|
||||||
|
|
||||||
<para>The value <literal>0</literal> means that there is no
|
|
||||||
timeout. This is also the default.</para>
|
|
||||||
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="conf-build-users-group"><term><literal>build-users-group</literal></term>
|
|
||||||
|
|
||||||
<listitem><para>This options specifies the Unix group containing
|
|
||||||
the Nix build user accounts. In multi-user Nix installations,
|
|
||||||
builds should not be performed by the Nix account since that would
|
|
||||||
allow users to arbitrarily modify the Nix store and database by
|
|
||||||
supplying specially crafted builders; and they cannot be performed
|
|
||||||
by the calling user since that would allow him/her to influence
|
|
||||||
the build result.</para>
|
|
||||||
|
|
||||||
<para>Therefore, if this option is non-empty and specifies a valid
|
|
||||||
group, builds will be performed under the user accounts that are a
|
|
||||||
member of the group specified here (as listed in
|
|
||||||
<filename>/etc/group</filename>). Those user accounts should not
|
|
||||||
be used for any other purpose!</para>
|
|
||||||
|
|
||||||
<para>Nix will never run two builds under the same user account at
|
|
||||||
the same time. This is to prevent an obvious security hole: a
|
|
||||||
malicious user writing a Nix expression that modifies the build
|
|
||||||
result of a legitimate Nix expression being built by another user.
|
|
||||||
Therefore it is good to have as many Nix build user accounts as
|
|
||||||
you can spare. (Remember: uids are cheap.)</para>
|
|
||||||
|
|
||||||
<para>The build users should have permission to create files in
|
|
||||||
the Nix store, but not delete them. Therefore,
|
|
||||||
<filename>/nix/store</filename> should be owned by the Nix
|
|
||||||
account, its group should be the group specified here, and its
|
|
||||||
mode should be <literal>1775</literal>.</para>
|
|
||||||
|
|
||||||
<para>If the build users group is empty, builds will be performed
|
|
||||||
under the uid of the Nix process (that is, the uid of the caller
|
|
||||||
if <envar>NIX_REMOTE</envar> is empty, the uid under which the Nix
|
|
||||||
daemon runs if <envar>NIX_REMOTE</envar> is
|
|
||||||
<literal>daemon</literal>, or the uid that owns the setuid
|
|
||||||
<command>nix-worker</command> program if <envar>NIX_REMOTE</envar>
|
|
||||||
is <literal>slave</literal>). Obviously, this should not be used
|
|
||||||
in multi-user settings with untrusted users.</para>
|
|
||||||
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><literal>build-use-chroot</literal></term>
|
|
||||||
|
|
||||||
<listitem><para>If set to <literal>true</literal>, builds will be
|
|
||||||
performed in a <emphasis>chroot environment</emphasis>, i.e., the
|
|
||||||
build will be isolated from the normal file system hierarchy and
|
|
||||||
will only see the Nix store, the temporary build directory, and
|
|
||||||
the directories configured with the <link
|
|
||||||
linkend='conf-build-chroot-dirs'><literal>build-chroot-dirs</literal>
|
|
||||||
option</link> (such as <filename>/proc</filename> and
|
|
||||||
<filename>/dev</filename>). This is useful to prevent undeclared
|
|
||||||
dependencies on files in directories such as
|
|
||||||
<filename>/usr/bin</filename>.</para>
|
|
||||||
|
|
||||||
<para>The use of a chroot requires that Nix is run as root (but
|
|
||||||
you can still use the <link
|
|
||||||
linkend='conf-build-users-group'>“build users” feature</link> to
|
|
||||||
perform builds under different users than root). Currently,
|
|
||||||
chroot builds only work on Linux because Nix uses “bind mounts” to
|
|
||||||
make the Nix store and other directories available inside the
|
|
||||||
chroot.</para>
|
|
||||||
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="conf-build-chroot-dirs"><term><literal>build-chroot-dirs</literal></term>
|
|
||||||
|
|
||||||
<listitem><para>When builds are performed in a chroot environment,
|
|
||||||
Nix will mount (using <command>mount --bind</command> on Linux)
|
|
||||||
some directories from the normal file system hierarchy inside the
|
|
||||||
chroot. These are the Nix store, the temporary build directory
|
|
||||||
(usually
|
|
||||||
<filename>/tmp/nix-<replaceable>pid</replaceable>-<replaceable>number</replaceable></filename>)
|
|
||||||
and the directories listed here. The default is <literal>dev
|
|
||||||
/proc</literal>. Files in <filename>/dev</filename> (such as
|
|
||||||
<filename>/dev/null</filename>) are needed by many builds, and
|
|
||||||
some files in <filename>/proc</filename> may also be needed
|
|
||||||
occasionally.</para>
|
|
||||||
|
|
||||||
<para>The value used on NixOS is
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
build-use-chroot = /dev /proc /bin</programlisting>
|
|
||||||
|
|
||||||
to make the <filename>/bin/sh</filename> symlink available (which
|
|
||||||
is still needed by many builders).</para>
|
|
||||||
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><literal>system</literal></term>
|
|
||||||
|
|
||||||
<listitem><para>This option specifies the canonical Nix system
|
|
||||||
name of the current installation, such as
|
|
||||||
<literal>i686-linux</literal> or
|
|
||||||
<literal>powerpc-darwin</literal>. Nix can only build derivations
|
|
||||||
whose <literal>system</literal> attribute equals the value
|
|
||||||
specified here. In general, it never makes sense to modify this
|
|
||||||
value from its default, since you can use it to ‘lie’ about the
|
|
||||||
platform you are building on (e.g., perform a Mac OS build on a
|
|
||||||
Linux machine; the result would obviously be wrong). It only
|
|
||||||
makes sense if the Nix binaries can run on multiple platforms,
|
|
||||||
e.g., ‘universal binaries’ that run on <literal>powerpc-darwin</literal> and
|
|
||||||
<literal>i686-darwin</literal>.</para>
|
|
||||||
|
|
||||||
<para>It defaults to the canonical Nix system name detected by
|
|
||||||
<filename>configure</filename> at build time.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><literal>fsync-metadata</literal></term>
|
|
||||||
|
|
||||||
<listitem><para>If set to <literal>true</literal>, changes to the
|
|
||||||
Nix store metadata (in <filename>/nix/var/nix/db</filename>) are
|
|
||||||
synchronously flushed to disk. This improves robustness in case
|
|
||||||
of system crashes, but reduces performance. The default is
|
|
||||||
<literal>true</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
</sect1>
|
||||||
</section>
|
|
||||||
+51
-66
@@ -1,15 +1,21 @@
|
|||||||
<section xmlns="http://docbook.org/ns/docbook"
|
<sect1 id="sec-common-env"><title>Common environment variables</title>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xml:id="sec-common-env">
|
|
||||||
|
|
||||||
<title>Common environment variables</title>
|
|
||||||
|
|
||||||
|
|
||||||
<para>Most Nix commands interpret the following environment variables:</para>
|
<para>Most Nix commands interpret the following environment variables:</para>
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
|
|
||||||
|
<varlistentry><term><envar>NIX_ROOT</envar></term>
|
||||||
|
|
||||||
|
<listitem><para>If <envar>NIX_ROOT</envar> is set, the Nix command
|
||||||
|
will on startup perform a <function>chroot()</function> to the
|
||||||
|
specified directory. This is useful in certain bootstrapping
|
||||||
|
situations (e.g., when installing a Nix installation onto a hard
|
||||||
|
disk from CD-ROM).</para></listitem>
|
||||||
|
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><envar>NIX_IGNORE_SYMLINK_STORE</envar></term>
|
<varlistentry><term><envar>NIX_IGNORE_SYMLINK_STORE</envar></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -112,7 +118,7 @@ $ mount -o bind /mnt/otherdisk/nix /nix</screen>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="envar-build-hook"><term><envar>NIX_BUILD_HOOK</envar></term>
|
<varlistentry id="envar-build-hook"><term><envar>NIX_BUILD_HOOK</envar></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
|
||||||
@@ -151,12 +157,12 @@ $ mount -o bind /mnt/otherdisk/nix /nix</screen>
|
|||||||
<para>On the basis of this information, and whatever persistent
|
<para>On the basis of this information, and whatever persistent
|
||||||
state the build hook keeps about other machines and their current
|
state the build hook keeps about other machines and their current
|
||||||
load, it has to decide what to do with the build. It should print
|
load, it has to decide what to do with the build. It should print
|
||||||
out on standard error one of the following responses (terminated by
|
out on file descriptor 3 one of the following responses (terminated
|
||||||
a newline, <literal>"\n"</literal>):
|
by a newline, <literal>"\n"</literal>):
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry><term><literal># decline</literal></term>
|
<varlistentry><term><literal>decline</literal></term>
|
||||||
|
|
||||||
<listitem><para>The build hook is not willing or able to perform
|
<listitem><para>The build hook is not willing or able to perform
|
||||||
the build; the calling Nix process should do the build itself,
|
the build; the calling Nix process should do the build itself,
|
||||||
@@ -164,7 +170,7 @@ $ mount -o bind /mnt/otherdisk/nix /nix</screen>
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><literal># postpone</literal></term>
|
<varlistentry><term><literal>postpone</literal></term>
|
||||||
|
|
||||||
<listitem><para>The build hook cannot perform the build now, but
|
<listitem><para>The build hook cannot perform the build now, but
|
||||||
can do so in the future (e.g., because all available build slots
|
can do so in the future (e.g., because all available build slots
|
||||||
@@ -174,7 +180,7 @@ $ mount -o bind /mnt/otherdisk/nix /nix</screen>
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><literal># accept</literal></term>
|
<varlistentry><term><literal>accept</literal></term>
|
||||||
|
|
||||||
<listitem><para>The build hook has accepted the
|
<listitem><para>The build hook has accepted the
|
||||||
build.</para></listitem>
|
build.</para></listitem>
|
||||||
@@ -185,12 +191,37 @@ $ mount -o bind /mnt/otherdisk/nix /nix</screen>
|
|||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>After sending <literal># accept</literal>, the hook should
|
<para>If the build hook accepts the build, it is possible that it is
|
||||||
read one line from standard input, which will be the string
|
no longer necessary to do the build because some other process has
|
||||||
<literal>okay</literal>. It can then proceed with the build.
|
performed the build in the meantime. To prevent races, the hook
|
||||||
Before sending <literal>okay</literal>, Nix will store in the hook’s
|
must read from file descriptor 4 a single line that tells it whether
|
||||||
current directory a number of text files that contain information
|
to continue:
|
||||||
about the derivation:
|
|
||||||
|
<variablelist>
|
||||||
|
|
||||||
|
<varlistentry><term><literal>cancel</literal></term>
|
||||||
|
|
||||||
|
<listitem><para>The build has already been done, so the hook
|
||||||
|
should exit.</para></listitem>
|
||||||
|
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry><term><literal>okay</literal></term>
|
||||||
|
|
||||||
|
<listitem><para>The hook should proceed with the build. At this
|
||||||
|
point, the calling Nix process has acquired locks on the output
|
||||||
|
path, so no other Nix process will perform the
|
||||||
|
build.</para></listitem>
|
||||||
|
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
</variablelist>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>If the hook has been told to proceed, Nix will store in the
|
||||||
|
hook’s current directory a number of text files that contain
|
||||||
|
information about the derivation:
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
@@ -230,9 +261,7 @@ $ mount -o bind /mnt/otherdisk/nix /nix</screen>
|
|||||||
<para>The hook should copy the inputs to the remote machine,
|
<para>The hook should copy the inputs to the remote machine,
|
||||||
register the validity of the inputs, perform the remote build, and
|
register the validity of the inputs, perform the remote build, and
|
||||||
copy the outputs back to the local machine. An exit code other than
|
copy the outputs back to the local machine. An exit code other than
|
||||||
<literal>0</literal> indicates that the hook has failed. An exit
|
<literal>0</literal> indicates that the hook has failed.</para>
|
||||||
code equal to 100 means that the remote build failed (as opposed to,
|
|
||||||
e.g., a network error).</para>
|
|
||||||
|
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
@@ -240,50 +269,6 @@ $ mount -o bind /mnt/otherdisk/nix /nix</screen>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="envar-remote"><term><envar>NIX_REMOTE</envar></term>
|
|
||||||
|
|
||||||
<listitem><para>This variable should be set to
|
|
||||||
<literal>daemon</literal> if you want to use the Nix daemon to
|
|
||||||
executed Nix operations, which is necessary in <link
|
|
||||||
linkend="ssec-multi-user">multi-user Nix installations</link>.
|
|
||||||
Otherwise, it should be left unset.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="envar-other-stores"><term><envar>NIX_OTHER_STORES</envar></term>
|
|
||||||
|
|
||||||
<listitem><para>This variable contains the paths of remote Nix
|
|
||||||
installations from whichs paths can be copied, separated by colons.
|
|
||||||
See <xref linkend="sec-sharing-packages" /> for details. Each path
|
|
||||||
should be the <filename>/nix</filename> directory of a remote Nix
|
|
||||||
installation (i.e., not the <filename>/nix/store</filename>
|
|
||||||
directory). The paths are subject to globbing, so you can set it so
|
|
||||||
something like <literal>/var/run/nix/remote-stores/*/nix</literal>
|
|
||||||
and mount multiple remote filesystems in
|
|
||||||
<literal>/var/run/nix/remote-stores</literal>.</para>
|
|
||||||
|
|
||||||
<para>Note that if you’re building through the <link
|
|
||||||
linkend="sec-nix-worker">Nix daemon</link>, the only setting for
|
|
||||||
this variable that matters is the one that the
|
|
||||||
<command>nix-worker</command> process uses. So if you want to
|
|
||||||
change it, you have to restart the daemon.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><envar>GC_INITIAL_HEAP_SIZE</envar></term>
|
|
||||||
|
|
||||||
<listitem><para>If Nix has been configured to use the Boehm garbage
|
|
||||||
collector, this variable sets the initial size of the heap in bytes.
|
|
||||||
It defaults to 384 MiB. Setting it to a low value reduces memory
|
|
||||||
consumption, but will increase runtime due to the overhead of
|
|
||||||
garbage collection.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
|
</sect1>
|
||||||
</section>
|
|
||||||
+12
-16
@@ -1,13 +1,9 @@
|
|||||||
<appendix xmlns="http://docbook.org/ns/docbook"
|
<appendix><title>Glossary</title>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
|
|
||||||
<title>Glossary</title>
|
|
||||||
|
|
||||||
|
|
||||||
<glosslist>
|
<glosslist>
|
||||||
|
|
||||||
|
|
||||||
<glossentry xml:id="gloss-derivation"><glossterm>derivation</glossterm>
|
<glossentry id="gloss-derivation"><glossterm>derivation</glossterm>
|
||||||
|
|
||||||
<glossdef><para>A description of a build action. The result of a
|
<glossdef><para>A description of a build action. The result of a
|
||||||
derivation is a store object. Derivations are typically specified
|
derivation is a store object. Derivations are typically specified
|
||||||
@@ -50,7 +46,7 @@
|
|||||||
</glossentry>
|
</glossentry>
|
||||||
|
|
||||||
|
|
||||||
<glossentry xml:id="gloss-substitute"><glossterm>substitute</glossterm>
|
<glossentry id="gloss-substitute"><glossterm>substitute</glossterm>
|
||||||
|
|
||||||
<glossdef><para>A substitute is a command invocation stored in the
|
<glossdef><para>A substitute is a command invocation stored in the
|
||||||
Nix database that describes how to build a store object, bypassing
|
Nix database that describes how to build a store object, bypassing
|
||||||
@@ -74,16 +70,16 @@
|
|||||||
|
|
||||||
<glossentry><glossterm>Nix expression</glossterm>
|
<glossentry><glossterm>Nix expression</glossterm>
|
||||||
|
|
||||||
<glossdef><para>A high-level description of software packages and
|
<glossdef><para>A high-level description of software components and
|
||||||
compositions thereof. Deploying software using Nix entails writing
|
compositions thereof. Deploying software using Nix entails writing
|
||||||
Nix expressions for your packages. Nix expressions are translated
|
Nix expressions for your components. Nix expressions are translated
|
||||||
to derivations that are stored in the Nix store. These derivations
|
to derivations that are stored in the Nix store. These derivations
|
||||||
can then be built.</para></glossdef>
|
can then be built.</para></glossdef>
|
||||||
|
|
||||||
</glossentry>
|
</glossentry>
|
||||||
|
|
||||||
|
|
||||||
<glossentry xml:id="gloss-reference"><glossterm>reference</glossterm>
|
<glossentry id="gloss-reference"><glossterm>reference</glossterm>
|
||||||
|
|
||||||
<glossdef><para>A store path <varname>P</varname> is said to have a
|
<glossdef><para>A store path <varname>P</varname> is said to have a
|
||||||
reference to a store path <varname>Q</varname> if the store object
|
reference to a store path <varname>Q</varname> if the store object
|
||||||
@@ -96,7 +92,7 @@
|
|||||||
</glossentry>
|
</glossentry>
|
||||||
|
|
||||||
|
|
||||||
<glossentry xml:id="gloss-closure"><glossterm>closure</glossterm>
|
<glossentry id="gloss-closure"><glossterm>closure</glossterm>
|
||||||
|
|
||||||
<glossdef><para>The closure of a store path is the set of store
|
<glossdef><para>The closure of a store path is the set of store
|
||||||
paths that are directly or indirectly “reachable” from that store
|
paths that are directly or indirectly “reachable” from that store
|
||||||
@@ -112,14 +108,14 @@
|
|||||||
</glossentry>
|
</glossentry>
|
||||||
|
|
||||||
|
|
||||||
<glossentry xml:id="gloss-output-path"><glossterm>output path</glossterm>
|
<glossentry id="gloss-output-path"><glossterm>output path</glossterm>
|
||||||
|
|
||||||
<glossdef><para>A store path produced by a derivation.</para></glossdef>
|
<glossdef><para>A store path produced by a derivation.</para></glossdef>
|
||||||
|
|
||||||
</glossentry>
|
</glossentry>
|
||||||
|
|
||||||
|
|
||||||
<glossentry xml:id="gloss-deriver"><glossterm>deriver</glossterm>
|
<glossentry id="gloss-deriver"><glossterm>deriver</glossterm>
|
||||||
|
|
||||||
<glossdef><para>The deriver of an <link
|
<glossdef><para>The deriver of an <link
|
||||||
linkend="gloss-output-path">output path</link> is the store
|
linkend="gloss-output-path">output path</link> is the store
|
||||||
@@ -128,7 +124,7 @@
|
|||||||
</glossentry>
|
</glossentry>
|
||||||
|
|
||||||
|
|
||||||
<glossentry xml:id="gloss-validity"><glossterm>validity</glossterm>
|
<glossentry id="gloss-validity"><glossterm>validity</glossterm>
|
||||||
|
|
||||||
<glossdef><para>A store path is considered
|
<glossdef><para>A store path is considered
|
||||||
<emphasis>valid</emphasis> if it exists in the file system, is
|
<emphasis>valid</emphasis> if it exists in the file system, is
|
||||||
@@ -138,7 +134,7 @@
|
|||||||
</glossentry>
|
</glossentry>
|
||||||
|
|
||||||
|
|
||||||
<glossentry xml:id="gloss-user-env"><glossterm>user environment</glossterm>
|
<glossentry id="gloss-user-env"><glossterm>user environment</glossterm>
|
||||||
|
|
||||||
<glossdef><para>An automatically generated store object that
|
<glossdef><para>An automatically generated store object that
|
||||||
consists of a set of symlinks to “active” applications, i.e., other
|
consists of a set of symlinks to “active” applications, i.e., other
|
||||||
@@ -151,7 +147,7 @@
|
|||||||
</glossentry>
|
</glossentry>
|
||||||
|
|
||||||
|
|
||||||
<glossentry xml:id="gloss-profile"><glossterm>profile</glossterm>
|
<glossentry id="gloss-profile"><glossterm>profile</glossterm>
|
||||||
|
|
||||||
<glossdef><para>A symlink to the current <link
|
<glossdef><para>A symlink to the current <link
|
||||||
linkend="gloss-user-env">user environment</link> of a user, e.g.,
|
linkend="gloss-user-env">user environment</link> of a user, e.g.,
|
||||||
|
|||||||
+114
-384
@@ -1,72 +1,36 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<chapter id='chap-installation'><title>Installation</title>
|
||||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xml:id="chap-installation">
|
|
||||||
|
|
||||||
<title>Installation</title>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>Supported platforms</title>
|
<sect1><title>Obtaining Nix</title>
|
||||||
|
|
||||||
<para>Nix is currently supported on the following platforms:
|
<para>The easiest way to obtain Nix is to download a <ulink
|
||||||
|
url='http://www.cs.uu.nl/groups/ST/Trace/Nix'>source
|
||||||
<itemizedlist>
|
distribution</ulink>. RPMs for Red Hat, SuSE, and Fedore Core are
|
||||||
|
also available.</para>
|
||||||
<listitem><para>Linux (particularly on x86, x86_64, and
|
|
||||||
PowerPC).</para></listitem>
|
|
||||||
|
|
||||||
<listitem><para>Mac OS X, both on Intel and
|
|
||||||
PowerPC.</para></listitem>
|
|
||||||
|
|
||||||
<listitem><para>FreeBSD (only tested on Intel).</para></listitem>
|
|
||||||
|
|
||||||
<listitem><para>Windows through <link
|
|
||||||
xlink:href="http://www.cygwin.com/">Cygwin</link>.</para>
|
|
||||||
|
|
||||||
<warning><para>On Cygwin, Nix <emphasis>must</emphasis> be installed
|
|
||||||
on an NTFS partition. It will not work correctly on a FAT
|
|
||||||
partition.</para></warning>
|
|
||||||
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
</itemizedlist>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>Nix is pretty portable, so it should work on most other Unix
|
|
||||||
platforms as well.</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>Obtaining Nix</title>
|
|
||||||
|
|
||||||
<para>The easiest way to obtain Nix is to download a <link
|
|
||||||
xlink:href="http://nixos.org/">source distribution</link>. RPMs
|
|
||||||
for Red Hat, SuSE, and Fedora Core are also available.</para>
|
|
||||||
|
|
||||||
<para>Alternatively, the most recent sources of Nix can be obtained
|
<para>Alternatively, the most recent sources of Nix can be obtained
|
||||||
from its <link
|
from its <ulink
|
||||||
xlink:href="https://svn.nixos.org/repos/nix/nix/trunk">Subversion
|
url='https://svn.cs.uu.nl:12443/repos/trace/nix/trunk'>Subversion
|
||||||
repository</link>. For example, the following command will check out
|
repository</ulink>. For example, the following command will check out
|
||||||
the latest revision into a directory called
|
the latest revision into a directory called <filename>nix</filename>:</para>
|
||||||
<filename>nix</filename>:</para>
|
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ svn checkout https://svn.nixos.org/repos/nix/nix/trunk nix</screen>
|
$ svn checkout https://svn.cs.uu.nl:12443/repos/trace/nix/trunk nix</screen>
|
||||||
|
|
||||||
<para>Likewise, specific releases can be obtained from the <link
|
<para>Likewise, specific releases can be obtained from the <ulink
|
||||||
xlink:href="https://svn.nixos.org/repos/nix/nix/tags">tags
|
url='https://svn.cs.uu.nl:12443/repos/trace/nix/tags'>tags
|
||||||
directory</link> of the repository.</para>
|
directory</ulink> of the repository. If you don't have Subversion,
|
||||||
|
you can also download an automatically generated <ulink
|
||||||
|
url='https://svn.cs.uu.nl:12443/dist/trace/'>compressed
|
||||||
|
tar-file</ulink> of the head revision of the trunk.</para>
|
||||||
|
|
||||||
</section>
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
<section><title>Prerequisites</title>
|
<sect1><title>Prerequisites</title>
|
||||||
|
|
||||||
<para><emphasis>The following prerequisites only apply when you build
|
<para>The following prerequisites only apply when you build from
|
||||||
from source</emphasis>. Binary releases (e.g., RPMs) have no
|
source. Binary releases (e.g., RPMs) have no prerequisites.</para>
|
||||||
prerequisites.</para>
|
|
||||||
|
|
||||||
<para>A fairly recent version of GCC/G++ is required. Version 2.95
|
<para>A fairly recent version of GCC/G++ is required. Version 2.95
|
||||||
and higher should work.</para>
|
and higher should work.</para>
|
||||||
@@ -75,391 +39,157 @@ and higher should work.</para>
|
|||||||
<command>xmllint</command> and <command>xsltproc</command> programs,
|
<command>xmllint</command> and <command>xsltproc</command> programs,
|
||||||
which are part of the <literal>libxml2</literal> and
|
which are part of the <literal>libxml2</literal> and
|
||||||
<literal>libxslt</literal> packages, respectively. You also need the
|
<literal>libxslt</literal> packages, respectively. You also need the
|
||||||
<link
|
<ulink url='http://docbook.sourceforge.net/projects/xsl/'>DocBook XSL
|
||||||
xlink:href="http://docbook.sourceforge.net/projects/xsl/">DocBook XSL
|
stylesheets</ulink> and optionally the <ulink
|
||||||
stylesheets</link> and optionally the <link
|
url='http://www.oasis-open.org/docbook/xml/4.2/docbook-xml-4.2.zip'>
|
||||||
xlink:href="http://www.docbook.org/schemas/5x"> DocBook 5.0 RELAX NG
|
DocBook XML 4.2 DTD</ulink>. Note that these are only required if you
|
||||||
schemas</link>. Note that these are only required if you modify the
|
modify the manual sources or when you are building from the Subversion
|
||||||
manual sources or when you are building from the Subversion
|
|
||||||
repository.</para>
|
repository.</para>
|
||||||
|
|
||||||
<para>To build the parser, very <emphasis>recent</emphasis> versions
|
<para>To build the parser, very <emphasis>recent</emphasis> versions
|
||||||
of Bison and Flex are required. (This is because Nix needs GLR
|
of Bison and Flex are required. (This is because Nix needs GLR
|
||||||
support in Bison and reentrancy support in Flex.) For Bison, you need
|
support in Bison and reentrancy support in Flex.) For Bison, you need
|
||||||
version 2.3 or higher (1.875 does <emphasis>not</emphasis> work),
|
version 1.875c or higher (1.875 does <emphasis>not</emphasis> work),
|
||||||
which can be obtained from
|
which can be obtained from the <ulink
|
||||||
the <link xlink:href="ftp://alpha.gnu.org/pub/gnu/bison">GNU FTP
|
url='ftp://alpha.gnu.org/pub/gnu/bison'>GNU FTP server</ulink>. For
|
||||||
server</link>. For Flex, you need version 2.5.33, which is available
|
Flex, you need version 2.5.31, which is available on <ulink
|
||||||
on <link xlink:href="http://lex.sourceforge.net/">SourceForge</link>.
|
url='http://lex.sourceforge.net/'>SourceForge</ulink>. Slightly older
|
||||||
Slightly older versions may also work, but ancient versions like the
|
versions may also work, but ancient versions like the ubiquitous
|
||||||
ubiquitous 2.5.4a won't. Note that these are only required if you
|
2.5.4a won't. Note that these are only required if you modify the
|
||||||
modify the parser or when you are building from the Subversion
|
parser or when you are building from the Subversion repository.</para>
|
||||||
repository.</para>
|
|
||||||
|
|
||||||
<para>Nix uses the bzip2 compressor (including the bzip2 library). It
|
<para>Nix uses Sleepycat's Berkeley DB and CWI's ATerm library. These
|
||||||
is included in the Nix source distribution. If you build from the
|
are included in the Nix source distribution. If you build from the
|
||||||
Subversion repository, you must download it yourself and place it in
|
Subversion repository, you must download them yourself and place them
|
||||||
the <filename>externals/</filename> directory. See
|
in the <filename>externals/</filename> directory. See
|
||||||
<filename>externals/Makefile.am</filename> for the precise URLs of
|
<filename>externals/Makefile.am</filename> for the precise URLs of
|
||||||
this packages. Alternatively, if you already have it installed, you
|
these packages. Alternatively, if you already have them installed,
|
||||||
can use <command>configure</command>'s <option>--with-bzip2</option>
|
you can use <command>configure</command>'s <option>--with-bdb</option>
|
||||||
options to point to their respective locations.</para>
|
and <option>--with-aterm</option> options to point to their respective
|
||||||
|
locations. Note that Berkeley DB <emphasis>must</emphasis> be version
|
||||||
|
4.2; other versions may not have compatible database formats.</para>
|
||||||
|
|
||||||
<para>Nix can optionally use the <link
|
</sect1>
|
||||||
xlink:href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/">Boehm
|
|
||||||
garbage collector</link> to reduce the evaluator’s memory consumption.
|
|
||||||
To enable it, install <literal>pkgconfig</literal> and the Boehm
|
|
||||||
garbage collector, and pass the flag <option>--enable-gc</option> to
|
|
||||||
<command>configure</command>.</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>Building Nix from source</title>
|
<sect1><title>Building Nix from source</title>
|
||||||
|
|
||||||
<para>After unpacking or checking out the Nix sources, issue the
|
<para>After unpacking or checking out the Nix sources, issue the
|
||||||
following commands:
|
following commands:
|
||||||
|
</para>
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ ./configure <replaceable>options...</replaceable>
|
$ ./configure <replaceable>options...</replaceable>
|
||||||
$ make
|
$ make
|
||||||
$ make install</screen>
|
$ make install</screen>
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>When building from the Subversion repository, these should be
|
<para>When building from the Subversion repository, these should be
|
||||||
preceded by the command:
|
preceded by the command:
|
||||||
|
</para>
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ ./bootstrap.sh</screen>
|
$ autoreconf -i</screen>
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>The installation path can be specified by passing the
|
<para>The installation path can be specified by passing the
|
||||||
<option>--prefix=<replaceable>prefix</replaceable></option> to
|
<option>--prefix=<replaceable>prefix</replaceable></option> to
|
||||||
<command>configure</command>. The default installation directory is
|
<command>configure</command>. The default installation directory is
|
||||||
<filename>/usr/local</filename>. You can change this to any location
|
<filename>/nix</filename>. You can change this to any location you
|
||||||
you like. You must have write permission to the
|
like. You must have write permission to the
|
||||||
<replaceable>prefix</replaceable> path.</para>
|
<replaceable>prefix</replaceable> path.</para>
|
||||||
|
|
||||||
<para>Nix keeps its <emphasis>store</emphasis> (the place where
|
<warning><para>It is advisable <emphasis>not</emphasis> to change the
|
||||||
packages are stored) in <filename>/nix/store</filename> by default.
|
installation prefix from its default, since doing so will in all
|
||||||
This can be changed using
|
likelihood make it impossible to use derivations built on other
|
||||||
<option>--with-store-dir=<replaceable>path</replaceable></option>.</para>
|
systems.</para></warning>
|
||||||
|
|
||||||
<warning><para>It is best <emphasis>not</emphasis> to change the Nix
|
<para>If you want to rebuilt the documentation, pass the full path to
|
||||||
store from its default, since doing so makes it impossible to use
|
the DocBook XML catalog file (<filename>docbook.cat</filename>) and to
|
||||||
pre-built binaries from the standard Nixpkgs channels — that is, all
|
the DocBook XSL stylesheets using the
|
||||||
packages will need to be built from source.</para></warning>
|
<option>--with-docbook-catalog=<replaceable>path</replaceable></option>
|
||||||
|
|
||||||
<para>Nix keeps state (such as its database and log files) in
|
|
||||||
<filename>/nix/var</filename> by default. This can be changed using
|
|
||||||
<option>--localstatedir=<replaceable>path</replaceable></option>.</para>
|
|
||||||
|
|
||||||
<para>If you want to rebuild the documentation, pass the full path to
|
|
||||||
the DocBook RELAX NG schemas and to the DocBook XSL stylesheets using
|
|
||||||
the
|
|
||||||
<option>--with-docbook-rng=<replaceable>path</replaceable></option>
|
|
||||||
and
|
and
|
||||||
<option>--with-docbook-xsl=<replaceable>path</replaceable></option>
|
<option>--with-docbook-xsl=<replaceable>path</replaceable></option>
|
||||||
options.</para>
|
options.</para>
|
||||||
|
|
||||||
</section>
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
<section><title>Installing a binary distribution</title>
|
<sect1><title>Installing from RPMs</title>
|
||||||
|
|
||||||
<para>RPM and Deb packages of Nix for a number of different versions
|
<para>RPM packages of Nix can be downloaded from <ulink
|
||||||
of Fedora, openSUSE, Debian and Ubuntu can be downloaded from <link
|
url='http://www.cs.uu.nl/groups/ST/Trace/Nix' />. These RPMs should
|
||||||
xlink:href="http://nixos.org/" />. Once downloaded, the RPMs can be
|
work for most fairly recent releases of SuSE and Red Hat Linux. They
|
||||||
installed or upgraded using <command>rpm -U</command>. For example,
|
have been known to work work on SuSE Linux 8.1 and 9.0, and Red Hat
|
||||||
|
9.0. In fact, it should work on any RPM-based Linux distribution
|
||||||
|
based on <literal>glibc</literal> 2.3 or later.</para>
|
||||||
|
|
||||||
|
<para>Once downloaded, the RPMs can be installed or upgraded using
|
||||||
|
<command>rpm -U</command>. For example,</para>
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ rpm -U nix-0.13pre18104-1.i386.rpm</screen>
|
$ rpm -U nix-0.5pre664-1.i386.rpm</screen>
|
||||||
|
|
||||||
Likewise, for a Deb package:
|
<para>The RPMs install into the directory <filename>/nix</filename>.
|
||||||
|
Nix can be uninstalled using <command>rpm -e nix</command>. After
|
||||||
<screen>
|
this it will be necessary to manually remove the Nix store and other
|
||||||
$ dpkg -i nix_0.13pre18104-1_amd64.deb</screen>
|
auxiliary data:</para>
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>Nix can be uninstalled using <command>rpm -e nix</command> or
|
|
||||||
<command>dpkg -r nix</command>. After this you should manually remove
|
|
||||||
the Nix store and other auxiliary data, if desired:
|
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ rm -rf /nix/store
|
$ rm -rf /nix/store
|
||||||
$ rm -rf /nix/var</screen>
|
$ rm -rf /nix/var</screen>
|
||||||
|
|
||||||
</para>
|
</sect1>
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- TODO: should be updated
|
<sect1><title>Permissions</title>
|
||||||
<section><title>Upgrading Nix through Nix</title>
|
|
||||||
|
|
||||||
<para>You can install the latest stable version of Nix through Nix
|
<para>All Nix operations must be performed under the user ID that owns
|
||||||
itself by subscribing to the channel <link
|
the Nix store and database
|
||||||
xlink:href="http://nixos.org/releases/nix/channels/nix-stable" />,
|
(<filename><replaceable>prefix</replaceable>/store</filename> and
|
||||||
or the latest unstable version by subscribing to the channel <link
|
<filename><replaceable>prefix</replaceable>/var/nix/db</filename>,
|
||||||
xlink:href="http://nixos.org/releases/nix/channels/nix-unstable" />.
|
respectively). When installed from the RPM packages, these
|
||||||
You can also do a <link linkend="sec-one-click">one-click
|
directories are owned by <systemitem
|
||||||
installation</link> by clicking on the package links at <link
|
class='username'>root</systemitem>.</para>
|
||||||
xlink:href="http://nixos.org/releases/full-index-nix.html" />.</para>
|
|
||||||
|
|
||||||
</section>
|
<sect2><title>Setuid installation</title>
|
||||||
-->
|
|
||||||
|
|
||||||
|
<para>As a somewhat <emphasis>ad hoc</emphasis> hack, you can also
|
||||||
|
install the Nix binaries <quote>setuid</quote> so that a Nix store can
|
||||||
|
be shared among several users. To do this, configure Nix with the
|
||||||
|
<emphasis>--enable-setuid</emphasis> option. Nix will be installed as
|
||||||
|
owned by a user and group specified by the
|
||||||
|
<option>--with-nix-user=<parameter>user</parameter></option> and
|
||||||
|
<option>--with-nix-group=<parameter>group</parameter></option>
|
||||||
|
options. E.g.,
|
||||||
|
|
||||||
<section><title>Security</title>
|
<screen>
|
||||||
|
$ ./configure --enable-setuid --with-nix-user=my_nix_user --with-nix-group=my_nix_group</screen>
|
||||||
|
|
||||||
<para>Nix has two basic security models. First, it can be used in
|
The user and group default to <literal>nix</literal>. You should make
|
||||||
“single-user mode”, which is similar to what most other package
|
sure that both the user and the group exist. Any <quote>real</quote>
|
||||||
management tools do: there is a single user (typically <systemitem
|
users that you want to allow access should be added to the Nix
|
||||||
class="username">root</systemitem>) who performs all package
|
|
||||||
management operations. All other users can then use the installed
|
|
||||||
packages, but they cannot perform package management operations
|
|
||||||
themselves.</para>
|
|
||||||
|
|
||||||
<para>Alternatively, you can configure Nix in “multi-user mode”. In
|
|
||||||
this model, all users can perform package management operations — for
|
|
||||||
instance, every user can install software without requiring root
|
|
||||||
privileges. Nix ensures that this is secure. For instance, it’s not
|
|
||||||
possible for one user to overwrite a package used by another user with
|
|
||||||
a Trojan horse.</para>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>Single-user mode</title>
|
|
||||||
|
|
||||||
<para>In single-user mode, all Nix operations that access the database
|
|
||||||
in <filename><replaceable>prefix</replaceable>/var/nix/db</filename>
|
|
||||||
or modify the Nix store in
|
|
||||||
<filename><replaceable>prefix</replaceable>/store</filename> must be
|
|
||||||
performed under the user ID that owns those directories. This is
|
|
||||||
typically <systemitem class="username">root</systemitem>. (If you
|
|
||||||
install from RPM packages, that’s in fact the default ownership.)
|
|
||||||
However, on single-user machines, it is often convenient to
|
|
||||||
<command>chown</command> those directories to your normal user account
|
|
||||||
so that you don’t have to <command>su</command> to <systemitem
|
|
||||||
class="username">root</systemitem> all the time.</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<section xml:id="ssec-multi-user"><title>Multi-user mode</title>
|
|
||||||
|
|
||||||
<para>To allow a Nix store to be shared safely among multiple users,
|
|
||||||
it is important that users are not able to run builders that modify
|
|
||||||
the Nix store or database in arbitrary ways, or that interfere with
|
|
||||||
builds started by other users. If they could do so, they could
|
|
||||||
install a Trojan horse in some package and compromise the accounts of
|
|
||||||
other users.</para>
|
|
||||||
|
|
||||||
<para>To prevent this, the Nix store and database are owned by some
|
|
||||||
privileged user (usually <literal>root</literal>) and builders are
|
|
||||||
executed under special user accounts (usually named
|
|
||||||
<literal>nixbld1</literal>, <literal>nixbld2</literal>, etc.). When a
|
|
||||||
unprivileged user runs a Nix command, actions that operate on the Nix
|
|
||||||
store (such as builds) are forwarded to a <emphasis>Nix
|
|
||||||
daemon</emphasis> running under the owner of the Nix store/database
|
|
||||||
that performs the operation.</para>
|
|
||||||
|
|
||||||
<note><para>Multi-user mode has one important limitation: only
|
|
||||||
<systemitem class="username">root</systemitem> can run <command
|
|
||||||
linkend="sec-nix-pull">nix-pull</command> to register the availability
|
|
||||||
of pre-built binaries. However, those registrations are shared by all
|
|
||||||
users, so they still get the benefit from <command>nix-pull</command>s
|
|
||||||
done by <systemitem class="username">root</systemitem>.</para></note>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>Setting up the build users</title>
|
|
||||||
|
|
||||||
<para>The <emphasis>build users</emphasis> are the special UIDs under
|
|
||||||
which builds are performed. They should all be members of the
|
|
||||||
<emphasis>build users group</emphasis> (usually called
|
|
||||||
<literal>nixbld</literal>). This group should have no other members.
|
|
||||||
The build users should not be members of any other group.</para>
|
|
||||||
|
|
||||||
<para>Here is a typical <filename>/etc/group</filename> definition of
|
|
||||||
the build users group with 10 build users:
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
nixbld:!:30000:nixbld1,nixbld2,nixbld3,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9,nixbld10
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
In this example the <literal>nixbld</literal> group has UID 30000, but
|
|
||||||
of course it can be anything that doesn’t collide with an existing
|
|
||||||
group.</para>
|
group.</para>
|
||||||
|
|
||||||
<para>Here is the corresponding part of
|
<warning><para>A setuid installation should only by used if the users
|
||||||
<filename>/etc/passwd</filename>:
|
in the Nix group are mutually trusted, since any user in that group
|
||||||
|
has the ability to change anything in the Nix store or database. For
|
||||||
|
instance, they could install a trojan horse in executables used by
|
||||||
|
other users.</para></warning>
|
||||||
|
|
||||||
<programlisting>
|
<warning><para>On some platforms, the Nix binaries will be installed
|
||||||
nixbld1:x:30001:65534:Nix build user 1:/var/empty:/noshell
|
as setuid <literal>root</literal>. They drop root privileges
|
||||||
nixbld2:x:30002:65534:Nix build user 2:/var/empty:/noshell
|
immediately after startup and switch to the Nix user. The reason for
|
||||||
nixbld3:x:30003:65534:Nix build user 3:/var/empty:/noshell
|
this is that both the real and effective user must be set to the Nix
|
||||||
...
|
user, and POSIX has no system call to do this. This is not the case
|
||||||
nixbld10:x:30010:65534:Nix build user 10:/var/empty:/noshell
|
on systems that have the <function>setresuid()</function> system call
|
||||||
</programlisting>
|
(such as Linux and FreeBSD), so on those systems the binaries are
|
||||||
|
simply owned by the Nix user.</para></warning>
|
||||||
|
|
||||||
The home directory of the build users should not exist or should be an
|
</sect2>
|
||||||
empty directory to which they do not have write access.</para>
|
|
||||||
|
|
||||||
<para>The build users should have write access to the Nix store, but
|
</sect1>
|
||||||
they should not have the right to delete files. Thus the Nix store’s
|
|
||||||
group should be the build users group, and it should have the sticky
|
|
||||||
bit turned on (like <filename>/tmp</filename>):
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ chgrp nixbld /nix/store
|
|
||||||
$ chmod 1777 /nix/store
|
|
||||||
</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>Finally, you should tell Nix to use the build users by
|
|
||||||
specifying the build users group in the <link
|
|
||||||
linkend="conf-build-users-group"><literal>build-users-group</literal>
|
|
||||||
option</link> in the <link linkend="sec-conf-file">Nix configuration
|
|
||||||
file</link> (<literal>/nix/etc/nix/nix.conf</literal>):
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
build-users-group = nixbld
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>Nix store/database owned by root</title>
|
<sect1><title>Using Nix</title>
|
||||||
|
|
||||||
<para>The simplest setup is to let <literal>root</literal> own the Nix
|
|
||||||
store and database. I.e.,
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ chown -R root /nix/store /nix/var/nix</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>The <link linkend="sec-nix-worker">Nix daemon</link> should be
|
|
||||||
started as follows (as <literal>root</literal>):
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-worker --daemon</screen>
|
|
||||||
|
|
||||||
You’ll want to put that line somewhere in your system’s boot
|
|
||||||
scripts.</para>
|
|
||||||
|
|
||||||
<para>To let unprivileged users use the daemon, they should set the
|
|
||||||
<link linkend="envar-remote"><envar>NIX_REMOTE</envar> environment
|
|
||||||
variable</link> to <literal>daemon</literal>. So you should put a
|
|
||||||
line like
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
export NIX_REMOTE=daemon</programlisting>
|
|
||||||
|
|
||||||
into the users’ login scripts.</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>Nix store/database not owned by root</title>
|
|
||||||
|
|
||||||
<para>It is also possible to let the Nix store and database be owned
|
|
||||||
by a non-root user, which should be more secure<footnote><para>Note
|
|
||||||
however that even when the Nix daemon runs as root, not
|
|
||||||
<emphasis>that</emphasis> much code is executed as root: Nix
|
|
||||||
expression evaluation is performed by the calling (unprivileged) user,
|
|
||||||
and builds are performed under the special build user accounts. So
|
|
||||||
only the code that accesses the database and starts builds is executed
|
|
||||||
as <literal>root</literal>.</para></footnote>. Typically, this user
|
|
||||||
is a special account called <literal>nix</literal>, but it can be
|
|
||||||
named anything. It should own the Nix store and database:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ chown -R root /nix/store /nix/var/nix</screen>
|
|
||||||
|
|
||||||
and of course <command>nix-worker --daemon</command> should be started
|
|
||||||
under that user, e.g.,
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ su - nix -c "exec /nix/bin/nix-worker --daemon"</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>There is a catch, though: non-<literal>root</literal> users
|
|
||||||
cannot start builds under the build user accounts, since the
|
|
||||||
<function>setuid</function> system call is obviously privileged. To
|
|
||||||
allow a non-<literal>root</literal> Nix daemon to use the build user
|
|
||||||
feature, it calls a setuid-root helper program,
|
|
||||||
<command>nix-setuid-helper</command>. This program is installed in
|
|
||||||
<filename><replaceable>prefix</replaceable>/libexec/nix-setuid-helper</filename>.
|
|
||||||
To set the permissions properly (Nix’s <command>make install</command>
|
|
||||||
doesn’t do this, since we don’t want to ship setuid-root programs
|
|
||||||
out-of-the-box):
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ chown root.root /nix/libexec/nix-setuid-helper
|
|
||||||
$ chmod 4755 /nix/libexec/nix-setuid-helper
|
|
||||||
</screen>
|
|
||||||
|
|
||||||
(This example assumes that the Nix binaries are installed in
|
|
||||||
<filename>/nix</filename>.)</para>
|
|
||||||
|
|
||||||
<para>Of course, the <command>nix-setuid-helper</command> command
|
|
||||||
should not be usable by just anybody, since then anybody could run
|
|
||||||
commands under the Nix build user accounts. For that reason there is
|
|
||||||
a configuration file <filename>/etc/nix-setuid.conf</filename> that
|
|
||||||
restricts the use of the helper. This file should be a text file
|
|
||||||
containing precisely two lines, the first being the Nix daemon user
|
|
||||||
and the second being the build users group, e.g.,
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
nix
|
|
||||||
nixbld
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
The setuid-helper barfs if it is called by a user other than the one
|
|
||||||
specified on the first line, or if it is asked to execute a build
|
|
||||||
under a user who is not a member of the group specified on the second
|
|
||||||
line. The file <filename>/etc/nix-setuid.conf</filename> must be
|
|
||||||
owned by root, and must not be group- or world-writable. The
|
|
||||||
setuid-helper barfs if this is not the case.</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>Restricting access</title>
|
|
||||||
|
|
||||||
<para>To limit which users can perform Nix operations, you can use the
|
|
||||||
permissions on the directory
|
|
||||||
<filename>/nix/var/nix/daemon-socket</filename>. For instance, if you
|
|
||||||
want to restrict the use of Nix to the members of a group called
|
|
||||||
<literal>nix-users</literal>, do
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ chgrp nix-users /nix/var/nix/daemon-socket
|
|
||||||
$ chmod ug=rwx,o= /nix/var/nix/daemon-socket
|
|
||||||
</screen>
|
|
||||||
|
|
||||||
This way, users who are not in the <literal>nix-users</literal> group
|
|
||||||
cannot connect to the Unix domain socket
|
|
||||||
<filename>/nix/var/nix/daemon-socket/socket</filename>, so they cannot
|
|
||||||
perform Nix operations.</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
</section> <!-- end of multi-user -->
|
|
||||||
|
|
||||||
|
|
||||||
</section> <!-- end of security -->
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>Using Nix</title>
|
|
||||||
|
|
||||||
<para>To use Nix, some environment variables should be set. In
|
<para>To use Nix, some environment variables should be set. In
|
||||||
particular, <envar>PATH</envar> should contain the directories
|
particular, <envar>PATH</envar> should contain the directories
|
||||||
@@ -476,7 +206,7 @@ in your <filename>~/.bashrc</filename> (or similar), like this:</para>
|
|||||||
<screen>
|
<screen>
|
||||||
source <replaceable>prefix</replaceable>/etc/profile.d/nix.sh</screen>
|
source <replaceable>prefix</replaceable>/etc/profile.d/nix.sh</screen>
|
||||||
|
|
||||||
</section>
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
+121
-308
@@ -1,337 +1,150 @@
|
|||||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
<chapter><title>Introduction</title>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xml:id="chap-introduction">
|
|
||||||
|
|
||||||
<title>Introduction</title>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>About Nix</title>
|
|
||||||
|
|
||||||
<para>Nix is a <emphasis>purely functional package manager</emphasis>.
|
|
||||||
This means that it treats packages like values in purely functional
|
|
||||||
programming languages such as Haskell — they are built by functions
|
|
||||||
that don’t have side-effects, and they never change after they have
|
|
||||||
been built. Nix stores packages in the <emphasis>Nix
|
|
||||||
store</emphasis>, usually the directory
|
|
||||||
<filename>/nix/store</filename>, where each package has its own unique
|
|
||||||
subdirectory such as
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
/nix/store/r8vvq9kq18pz08v249h8my6r9vs7s0n3-firefox-2.0.0.1/
|
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
where <literal>r8vvq9kq…</literal> is a unique identifier for the
|
|
||||||
package that captures all its dependencies (it’s a cryptographic hash
|
|
||||||
of the package’s build dependency graph). This enables many powerful
|
|
||||||
features.</para>
|
|
||||||
|
|
||||||
|
|
||||||
<simplesect><title>Multiple versions</title>
|
|
||||||
|
|
||||||
<para>You can have multiple versions or variants of a package
|
|
||||||
installed at the same time. This is especially important when
|
|
||||||
different applications have dependencies on different versions of the
|
|
||||||
same package — it prevents the “DLL hell”. Because of the hashing
|
|
||||||
scheme, different versions of a package end up in different paths in
|
|
||||||
the Nix store, so they don’t interfere with each other.</para>
|
|
||||||
|
|
||||||
<para>An important consequence is that operations like upgrading or
|
|
||||||
uninstalling an application cannot break other applications, since
|
|
||||||
these operations never “destructively” update or delete files that are
|
|
||||||
used by other packages.</para>
|
|
||||||
|
|
||||||
</simplesect>
|
|
||||||
|
|
||||||
|
|
||||||
<simplesect><title>Complete dependencies</title>
|
|
||||||
|
|
||||||
<para>Nix helps you make sure that package dependency specifications
|
|
||||||
are complete. In general, when you’re making a package for a package
|
|
||||||
management system like RPM, you have to specify for each package what
|
|
||||||
its dependencies are, but there are no guarantees that this
|
|
||||||
specification is complete. If you forget a dependency, then the
|
|
||||||
package will build and work correctly on <emphasis>your</emphasis>
|
|
||||||
machine if you have the dependency installed, but not on the end
|
|
||||||
user's machine if it's not there.</para>
|
|
||||||
|
|
||||||
<para>Since Nix on the other hand doesn’t install packages in “global”
|
|
||||||
locations like <filename>/usr/bin</filename> but in package-specific
|
|
||||||
directories, the risk of incomplete dependencies is greatly reduced.
|
|
||||||
This is because tools such as compilers don’t search in per-packages
|
|
||||||
directories such as
|
|
||||||
<filename>/nix/store/5lbfaxb722zp…-openssl-0.9.8d/include</filename>,
|
|
||||||
so if a package builds correctly on your system, this is because you
|
|
||||||
specified the dependency explicitly.</para>
|
|
||||||
|
|
||||||
<para>Runtime dependencies are found by scanning binaries for the hash
|
|
||||||
parts of Nix store paths (such as <literal>r8vvq9kq…</literal>). This
|
|
||||||
sounds risky, but it works extremely well.</para>
|
|
||||||
|
|
||||||
</simplesect>
|
|
||||||
|
|
||||||
|
|
||||||
<simplesect><title>Multi-user support</title>
|
|
||||||
|
|
||||||
<para>Starting at version 0.11, Nix has multi-user support. This
|
|
||||||
means that non-privileged users can securely install software. Each
|
|
||||||
user can have a different <emphasis>profile</emphasis>, a set of
|
|
||||||
packages in the Nix store that appear in the user’s
|
|
||||||
<envar>PATH</envar>. If a user installs a package that another user
|
|
||||||
has already installed previously, the package won’t be built or
|
|
||||||
downloaded a second time. At the same time, it is not possible for
|
|
||||||
one user to inject a Trojan horse into a package that might be used by
|
|
||||||
another user.</para>
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<para>More details can be found in Section 3 of our <a
|
<epigraph><para><quote>The number of Nix installations in the world
|
||||||
href="docs/papers.html#securesharing">ASE 2005 paper</a>.</para>
|
has grown to 5, with more expected.</quote></para></epigraph>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
</simplesect>
|
<para>Nix is a system for the deployment of software. Software
|
||||||
|
deployment is concerned with the creation, distribution, and
|
||||||
|
management of software components (<quote>packages</quote>). Its main
|
||||||
|
features are:
|
||||||
|
|
||||||
|
<itemizedlist>
|
||||||
|
|
||||||
<simplesect><title>Atomic upgrades and rollbacks</title>
|
<listitem><para>It helps you make sure that dependency specifications
|
||||||
|
are complete. In general in a deployment system you have to specify
|
||||||
|
for each component what its dependencies are, but there are no
|
||||||
|
guarantees that this specification is complete. If you forget a
|
||||||
|
dependency, then the component will build and work correctly on
|
||||||
|
<emphasis>your</emphasis> machine if you have the dependency
|
||||||
|
installed, but not on the end user's machine if it's not
|
||||||
|
there.</para></listitem>
|
||||||
|
|
||||||
<para>Since package management operations never overwrite packages in
|
<listitem><para>It is possible to have <emphasis>multiple versions or
|
||||||
the Nix store but just add new versions in different paths, they are
|
variants</emphasis> of a component installed at the same time. In
|
||||||
<emphasis>atomic</emphasis>. So during a package upgrade, there is no
|
contrast, in systems such as RPM different versions of the same
|
||||||
time window in which the package has some files from the old version
|
package tend to install to the same location in the file system, so
|
||||||
and some files from the new version — which would be bad because a
|
installing one version will remove the other. This is especially
|
||||||
program might well crash if it’s started during that period.</para>
|
important if you want to use applications that have conflicting
|
||||||
|
requirements on different versions of a component (e.g., application A
|
||||||
|
requires version 1.0 of library X, while application B requires a
|
||||||
|
non-backwards compatible version 1.1).</para></listitem>
|
||||||
|
|
||||||
<para>And since package aren’t overwritten, the old versions are still
|
<listitem><para>Users can have different <quote>views</quote>
|
||||||
there after an upgrade. This means that you can <emphasis>roll
|
(<quote>profiles</quote> in Nix parlance) on the set of installed
|
||||||
back</emphasis> to the old version:</para>
|
applications in a system. For instance, one user can have version 1.0
|
||||||
|
of some package visible, while another is using version 1.1, and a
|
||||||
|
third doesn't use it at all.</para></listitem>
|
||||||
|
|
||||||
<screen>
|
<listitem><para>It is possible to atomically
|
||||||
$ nix-env --upgrade <replaceable>some-packages</replaceable>
|
<emphasis>upgrade</emphasis> software. I.e., there is no time window
|
||||||
$ nix-env --rollback
|
during an upgrade in which part of the old version and part of the new
|
||||||
</screen>
|
version are simultaneously visible (which might well cause the
|
||||||
|
component to fail).</para></listitem>
|
||||||
|
|
||||||
</simplesect>
|
<listitem><para>Likewise, it is possible to atomically roll back after
|
||||||
|
an install, upgrade, or uninstall action. That is, in a fast (O(1))
|
||||||
|
operation the previous configuration of the system can be restored.
|
||||||
|
This is because upgrade or uninstall actions don't actually remove
|
||||||
|
components from the system.</para></listitem>
|
||||||
|
|
||||||
|
<listitem><para>Unused components can be
|
||||||
|
<emphasis>garbage-collected</emphasis> automatically and safely: when
|
||||||
|
you remove an application from a profile, its dependencies will be
|
||||||
|
deleted by the garbage collector only if there are no other active
|
||||||
|
applications using them.</para></listitem>
|
||||||
|
|
||||||
<simplesect><title>Garbage collection</title>
|
<listitem><para>Nix supports both source-based deployment models
|
||||||
|
(where you distribute <emphasis>Nix expressions</emphasis> that tell
|
||||||
|
Nix how to build software from source) and binary-based deployment
|
||||||
|
models. The latter is more-or-less transparent: installation of
|
||||||
|
components is always based on Nix expressions, but if the expressions
|
||||||
|
have been built before and Nix knows that the resulting binaries are
|
||||||
|
available somewhere, it will use those instead.</para></listitem>
|
||||||
|
|
||||||
<para>When you uninstall a package like this…
|
<listitem><para>Nix is flexible in the deployment policies that it
|
||||||
|
supports. There is a clear separation between the tools that
|
||||||
|
implement basic Nix <emphasis>mechanisms</emphasis> (e.g., building
|
||||||
|
Nix expressions), and the tools that implement various deployment
|
||||||
|
<emphasis>policies</emphasis>. For instance, there is a concept of
|
||||||
|
<quote>Nix channels</quote> that can be used to keep software
|
||||||
|
installations up-to-date automatically from a network source. This is
|
||||||
|
a policy that is implemented by a fairly short Perl script, which can
|
||||||
|
be adapted easily to achieve similar policies.</para></listitem>
|
||||||
|
|
||||||
<screen>
|
<listitem><para>Nix component builds aim to be <quote>pure</quote>;
|
||||||
$ nix-env --uninstall firefox
|
that is, unaffected by anything other than the declared dependencies.
|
||||||
</screen>
|
This means that if a component was built successfully once, it can be
|
||||||
|
rebuilt again on another machine and the result will be the same. We
|
||||||
|
cannot <emphasis>guarantee</emphasis> this (e.g., if the build depends
|
||||||
|
on the time-of-day), but Nix (and the tools in the Nix Packages
|
||||||
|
collection) takes special care to help achieve this.</para></listitem>
|
||||||
|
|
||||||
the package isn’t deleted from the system right away (after all, you
|
<listitem><para>Nix expressions (the things that tell Nix how to build
|
||||||
might want to do a rollback, or it might be in the profiles of other
|
components) are self-contained: they describe not just components but
|
||||||
users). Instead, unused packages can be deleted safely by running the
|
complete compositions. In other words, Nix expressions also describe
|
||||||
<emphasis>garbage collector</emphasis>:
|
how to build all the dependencies. This is in contrast to component
|
||||||
|
specification languages like RPM spec files, which might say that a
|
||||||
|
component X depends on some other component Y, but since it does not
|
||||||
|
describe <emphasis>exactly</emphasis> what Y is, the result of
|
||||||
|
building or running X might be different on different machines.
|
||||||
|
Combined with purity, self-containedness ensures that a component that
|
||||||
|
<quote>works</quote> on one machine also works on another, when
|
||||||
|
deployed using Nix.</para></listitem>
|
||||||
|
|
||||||
<screen>
|
<listitem><para>The Nix expression language makes it easy to describe
|
||||||
$ nix-collect-garbage
|
variability in components (e.g., optional features or
|
||||||
</screen>
|
dependencies).</para></listitem>
|
||||||
|
|
||||||
This deletes all packages that aren’t in use by any user profile or by
|
<listitem><para>Nix is ideal for building build farms that do
|
||||||
a currently running program.</para>
|
continuous builds of software from a version management system, since
|
||||||
|
it can take care of building all the dependencies as well. Also, Nix
|
||||||
|
only rebuilds components that have changed, so there are no
|
||||||
|
unnecessary builds. In addition, Nix can transparently distribute
|
||||||
|
build jobs over different machines, including different
|
||||||
|
platforms.</para></listitem>
|
||||||
|
|
||||||
</simplesect>
|
<listitem><para>Nix can be used not only for software deployment, but
|
||||||
|
also for <emphasis>service deployment</emphasis>, such as the
|
||||||
|
deployment of a complete web server with all its configuration files,
|
||||||
|
static pages, software dependencies, and so on. Nix's advantages for
|
||||||
|
software deployment also apply here: for instance, the ability
|
||||||
|
trivially to have multiple configurations at the same time, or the
|
||||||
|
ability to do rollbacks.</para></listitem>
|
||||||
|
|
||||||
|
<listitem><para>Nix can efficiently upgrade between different versions
|
||||||
|
of a component through <emphasis>binary patching</emphasis>. If
|
||||||
|
patches are available on a server, and you try to install a new
|
||||||
|
version of some component, Nix will automatically apply a patch (or
|
||||||
|
sequence of patches), if available, to transform the installed
|
||||||
|
component into the new version.</para></listitem>
|
||||||
|
|
||||||
<simplesect><title>Functional package language</title>
|
</itemizedlist>
|
||||||
|
|
||||||
<para>Packages are built from <emphasis>Nix expressions</emphasis>,
|
</para>
|
||||||
which is a simple functional language. A Nix expression describes
|
|
||||||
everything that goes into a package build action (a “derivation”):
|
|
||||||
other packages, sources, the build script, environment variables for
|
|
||||||
the build script, etc. Nix tries very hard to ensure that Nix
|
|
||||||
expressions are <emphasis>deterministic</emphasis>: building a Nix
|
|
||||||
expression twice should yield the same result.</para>
|
|
||||||
|
|
||||||
<para>Because it’s a functional language, it’s easy to support
|
|
||||||
building variants of a package: turn the Nix expression into a
|
|
||||||
function and call it any number of times with the appropriate
|
|
||||||
arguments. Due to the hashing scheme, variants don’t conflict with
|
|
||||||
each other in the Nix store.</para>
|
|
||||||
|
|
||||||
</simplesect>
|
|
||||||
|
|
||||||
|
|
||||||
<simplesect><title>Transparent source/binary deployment</title>
|
|
||||||
|
|
||||||
<para>Nix expressions generally describe how to build a package from
|
|
||||||
source, so an installation action like
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-env --install firefox
|
|
||||||
</screen>
|
|
||||||
|
|
||||||
<emphasis>could</emphasis> cause quite a bit of build activity, as not
|
|
||||||
only Firefox but also all its dependencies (all the way up to the C
|
|
||||||
library and the compiler) would have to built, at least if they are
|
|
||||||
not already in the Nix store. This is a <emphasis>source deployment
|
|
||||||
model</emphasis>. For most users, building from source is not very
|
|
||||||
pleasant as it takes far too long. However, Nix can automatically
|
|
||||||
skip building from source and download a pre-built binary instead if
|
|
||||||
it knows about it. <emphasis>Nix channels</emphasis> provide Nix
|
|
||||||
expressions along with pre-built binaries.</para>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<para>source deployment model (like <a
|
|
||||||
href="http://www.gentoo.org/">Gentoo</a>) and a binary model (like
|
|
||||||
RPM)</para>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</simplesect>
|
|
||||||
|
|
||||||
|
|
||||||
<simplesect><title>Binary patching</title>
|
|
||||||
|
|
||||||
<para>In addition to downloading binaries automatically if they’re
|
|
||||||
available, Nix can download binary deltas that patch an existing
|
|
||||||
package in the Nix store into a new version. This speeds up
|
|
||||||
upgrades.</para>
|
|
||||||
|
|
||||||
</simplesect>
|
|
||||||
|
|
||||||
|
|
||||||
<simplesect><title>Nix Packages collection</title>
|
|
||||||
|
|
||||||
<para>We provide a large set of Nix expressions containing hundreds of
|
|
||||||
existing Unix packages, the <emphasis>Nix Packages
|
|
||||||
collection</emphasis> (Nixpkgs).</para>
|
|
||||||
|
|
||||||
</simplesect>
|
|
||||||
|
|
||||||
|
|
||||||
<simplesect><title>Service deployment</title>
|
|
||||||
|
|
||||||
<para>Nix can be used not only for rolling out packages, but also
|
|
||||||
complete <emphasis>configurations</emphasis> of services. This is
|
|
||||||
done by treating all the static bits of a service (such as software
|
|
||||||
packages, configuration files, control scripts, static web pages,
|
|
||||||
etc.) as “packages” that can be built by Nix expressions. As a
|
|
||||||
result, all the features above apply to services as well: for
|
|
||||||
instance, you can roll back a web server configuration if a
|
|
||||||
configuration change turns out to be undesirable, you can easily have
|
|
||||||
multiple instances of a service (e.g., a test and production server),
|
|
||||||
and because the whole service is built in a purely functional way from
|
|
||||||
a Nix expression, it is repeatable so you can easily reproduce the
|
|
||||||
service on another machine.</para>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<para>You can read more about this in our <a
|
|
||||||
href="docs/papers.html#servicecm">SCM-12 paper</a>.</para>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</simplesect>
|
|
||||||
|
|
||||||
|
|
||||||
<simplesect><title>Portability</title>
|
|
||||||
|
|
||||||
<para>Nix should run on most Unix systems, including Linux, FreeBSD and
|
|
||||||
Mac OS X. It is also supported on Windows using Cygwin.</para>
|
|
||||||
|
|
||||||
</simplesect>
|
|
||||||
|
|
||||||
|
|
||||||
<simplesect><title>NixOS</title>
|
|
||||||
|
|
||||||
<para>NixOS is a Linux distribution based on Nix. It uses Nix not
|
|
||||||
just for package management but also to manage the system
|
|
||||||
configuration (e.g., to build configuration files in
|
|
||||||
<filename>/etc</filename>). This means, among other things, that it’s
|
|
||||||
possible to easily roll back the entire configuration of the system to
|
|
||||||
an earlier state. Also, users can install software without root
|
|
||||||
privileges. For more information and downloads, see the <link
|
|
||||||
xlink:href="http://nixos.org/">NixOS homepage</link>.</para>
|
|
||||||
|
|
||||||
</simplesect>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- other features:
|
|
||||||
|
|
||||||
- build farms
|
|
||||||
- reproducibility (Nix expressions allows whole configuration to be rebuilt)
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>About us</title>
|
|
||||||
|
|
||||||
<para>Nix was originally developed at the <link
|
|
||||||
xlink:href="http://www.cs.uu.nl/">Department of Information and
|
|
||||||
Computing Sciences</link>, Utrecht University by the <link
|
|
||||||
xlink:href="http://www.cs.uu.nl/wiki/Trace/WebHome">TraCE
|
|
||||||
project</link> (2003-2008). The project was funded by the Software
|
|
||||||
Engineering Research Program <link
|
|
||||||
xlink:href="http://www.jacquard.nl/">Jacquard</link> to improve the
|
|
||||||
support for variability in software systems. Further funding is now
|
|
||||||
provided by the NIRICT LaQuSo Build Farm project.</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>About this manual</title>
|
|
||||||
|
|
||||||
<para>This manual tells you how to install and use Nix and how to
|
<para>This manual tells you how to install and use Nix and how to
|
||||||
write Nix expressions for software not already in the Nix Packages
|
write Nix expressions for software not already in the Nix Packages
|
||||||
collection. It also discusses some advanced topics, such as setting
|
collection. It also discusses some advanced topics, such as setting
|
||||||
up a Nix-based build farm.</para>
|
up a Nix-based build farm, and doing service deployment using
|
||||||
|
Nix.</para>
|
||||||
|
|
||||||
</section>
|
<note><para>Some background information on Nix can be found in three
|
||||||
|
papers. The ICSE 2004 paper <ulink
|
||||||
|
url='http://www.cs.uu.nl/~eelco/pubs/immdsd-icse2004-final.pdf'><citetitle>Imposing
|
||||||
<section><title>License</title>
|
a Memory Management Discipline on Software
|
||||||
|
Deployment</citetitle></ulink> discusses the hashing mechanism used to
|
||||||
<para>Nix is free software; you can redistribute it and/or modify it
|
ensure reliable dependency identification and non-interference between
|
||||||
under the terms of the <link
|
different versions and variants of packages. The LISA 2004 paper
|
||||||
xlink:href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General
|
<ulink
|
||||||
Public License</link> as published by the <link
|
url='http://www.cs.uu.nl/~eelco/pubs/nspfssd-lisa2004-final.pdf'><citetitle>Nix:
|
||||||
xlink:href="http://www.fsf.org/">Free Software Foundation</link>;
|
A Safe and Policy-Free System for Software
|
||||||
either version 2.1 of the License, or (at your option) any later
|
Deployment</citetitle></ulink> gives a more general discussion of Nix
|
||||||
version. Nix is distributed in the hope that it will be useful, but
|
from a system-administration perspective. The CBSE 2005 paper <ulink
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
url='http://www.cs.uu.nl/~eelco/pubs/eupfcdm-cbse2005-final.pdf'><citetitle>Efficient
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<section><title>More information</title>
|
|
||||||
|
|
||||||
<para>Some background information on Nix can be found in a number of
|
|
||||||
papers. The ICSE 2004 paper <citetitle
|
|
||||||
xlink:href='http://www.st.ewi.tudelft.nl/~dolstra/pubs/immdsd-icse2004-final.pdf'>Imposing
|
|
||||||
a Memory Management Discipline on Software Deployment</citetitle>
|
|
||||||
discusses the hashing mechanism used to ensure reliable dependency
|
|
||||||
identification and non-interference between different versions and
|
|
||||||
variants of packages. The LISA 2004 paper <citetitle
|
|
||||||
xlink:href='http://www.st.ewi.tudelft.nl/~dolstra/pubs/nspfssd-lisa2004-final.pdf'>Nix:
|
|
||||||
A Safe and Policy-Free System for Software Deployment</citetitle>
|
|
||||||
gives a more general discussion of Nix from a system-administration
|
|
||||||
perspective. The CBSE 2005 paper <citetitle
|
|
||||||
xlink:href='http://www.st.ewi.tudelft.nl/~dolstra/pubs/eupfcdm-cbse2005-final.pdf'>Efficient
|
|
||||||
Upgrading in a Purely Functional Component Deployment Model
|
Upgrading in a Purely Functional Component Deployment Model
|
||||||
</citetitle> is about transparent patch deployment in Nix. The SCM-12
|
</citetitle></ulink> is about transparent patch deployment in
|
||||||
paper <citetitle
|
Nix.</para></note>
|
||||||
xlink:href='http://www.st.ewi.tudelft.nl/~dolstra/pubs/servicecm-scm12-final.pdf'>
|
|
||||||
Service Configuration Management</citetitle> shows how services (e.g.,
|
|
||||||
web servers) can be deployed and managed through Nix. A short
|
|
||||||
overview of NixOS is given in the HotOS XI paper <citetitle
|
|
||||||
xlink:href="http://www.st.ewi.tudelft.nl/~dolstra/pubs/hotos-final.pdf">Purely
|
|
||||||
Functional System Configuration Management</citetitle>. The Nix
|
|
||||||
homepage has <link
|
|
||||||
xlink:href="http://nixos.org/docs/papers.html">an up-to-date list
|
|
||||||
of Nix-related papers</link>.</para>
|
|
||||||
|
|
||||||
<para>Nix is the subject of Eelco Dolstra’s PhD thesis <citetitle
|
|
||||||
xlink:href="http://igitur-archive.library.uu.nl/dissertations/2006-0118-200031/index.htm">The
|
|
||||||
Purely Functional Software Deployment Model</citetitle>, which
|
|
||||||
contains most of the papers listed above.</para>
|
|
||||||
|
|
||||||
<para>Nix has a homepage at <link
|
|
||||||
xlink:href="http://nixos.org/"/>.</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
+66
-69
@@ -1,86 +1,83 @@
|
|||||||
<book xmlns="http://docbook.org/ns/docbook"
|
<?xml version="1.0"?>
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
<!DOCTYPE book
|
||||||
|
PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||||
|
"http://www.docbook.org/xml/4.3/docbook-xml-4.3.zip"
|
||||||
|
[
|
||||||
|
]>
|
||||||
|
|
||||||
<info>
|
<book>
|
||||||
|
<title>Nix User's Guide</title>
|
||||||
<title>Nix User's Guide</title>
|
|
||||||
|
|
||||||
<subtitle>Draft (Version <xi:include href="version.txt"
|
|
||||||
parse="text" />)</subtitle>
|
|
||||||
|
|
||||||
|
<subtitle>Draft (Version <xi:include
|
||||||
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||||
|
href="version.txt" parse="text" />)</subtitle>
|
||||||
|
|
||||||
|
<bookinfo>
|
||||||
<author>
|
<author>
|
||||||
<personname>
|
<firstname>Eelco</firstname>
|
||||||
<firstname>Eelco</firstname>
|
<surname>Dolstra</surname>
|
||||||
<surname>Dolstra</surname>
|
|
||||||
</personname>
|
|
||||||
<affiliation>
|
|
||||||
<orgname>Delft University of Technology</orgname>
|
|
||||||
<orgdiv>Department of Software Technology</orgdiv>
|
|
||||||
</affiliation>
|
|
||||||
<contrib>Author</contrib>
|
|
||||||
</author>
|
</author>
|
||||||
|
|
||||||
<copyright>
|
<copyright>
|
||||||
<year>2004</year>
|
<year>2004</year>
|
||||||
<year>2005</year>
|
<year>2005</year>
|
||||||
<year>2006</year>
|
|
||||||
<year>2007</year>
|
|
||||||
<year>2008</year>
|
|
||||||
<year>2009</year>
|
|
||||||
<year>2010</year>
|
|
||||||
<holder>Eelco Dolstra</holder>
|
<holder>Eelco Dolstra</holder>
|
||||||
</copyright>
|
</copyright>
|
||||||
|
</bookinfo>
|
||||||
<date>August 2010</date>
|
|
||||||
|
|
||||||
</info>
|
|
||||||
|
|
||||||
|
|
||||||
<xi:include href="introduction.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml" />
|
||||||
<xi:include href="quick-start.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="quick-start.xml" />
|
||||||
<xi:include href="installation.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="installation.xml" />
|
||||||
<xi:include href="package-management.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="package-management.xml" />
|
||||||
<xi:include href="writing-nix-expressions.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="writing-nix-expressions.xml" />
|
||||||
<xi:include href="build-farm.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="build-farm.xml" />
|
||||||
|
|
||||||
|
|
||||||
<appendix>
|
<appendix>
|
||||||
<title>Command Reference</title>
|
<title>Command Reference</title>
|
||||||
<xi:include href="opt-common.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common.xml" />
|
||||||
<xi:include href="env-common.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="env-common.xml" />
|
||||||
<xi:include href="conf-file.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="conf-file.xml" />
|
||||||
|
<sect1 id="sec-nix-env">
|
||||||
<section>
|
<title>nix-env</title>
|
||||||
<title>Main commands</title>
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-env.xml" />
|
||||||
<xi:include href="nix-env.xml" />
|
</sect1>
|
||||||
<xi:include href="nix-instantiate.xml" />
|
<sect1 id="sec-nix-build">
|
||||||
<xi:include href="nix-store.xml" />
|
<title>nix-build</title>
|
||||||
</section>
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-build.xml" />
|
||||||
|
</sect1>
|
||||||
<section>
|
<sect1>
|
||||||
<title>Utilities</title>
|
<title>nix-store</title>
|
||||||
<xi:include href="nix-build.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-store.xml" />
|
||||||
<xi:include href="nix-channel.xml" />
|
</sect1>
|
||||||
<xi:include href="nix-collect-garbage.xml" />
|
<sect1 id="sec-nix-instantiate">
|
||||||
<xi:include href="nix-copy-closure.xml" />
|
<title>nix-instantiate</title>
|
||||||
<xi:include href="nix-hash.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-instantiate.xml" />
|
||||||
<xi:include href="nix-install-package.xml" />
|
</sect1>
|
||||||
<xi:include href="nix-prefetch-url.xml" />
|
<sect1>
|
||||||
<xi:include href="nix-pull.xml" />
|
<title>nix-collect-garbage</title>
|
||||||
<xi:include href="nix-push.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-collect-garbage.xml" />
|
||||||
<xi:include href="nix-worker.xml" />
|
</sect1>
|
||||||
</section>
|
<sect1 id="sec-nix-channel">
|
||||||
|
<title>nix-channel</title>
|
||||||
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-channel.xml" />
|
||||||
|
</sect1>
|
||||||
|
<sect1>
|
||||||
|
<title>nix-push</title>
|
||||||
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-push.xml" />
|
||||||
|
</sect1>
|
||||||
|
<sect1>
|
||||||
|
<title>nix-pull</title>
|
||||||
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-pull.xml" />
|
||||||
|
</sect1>
|
||||||
|
<sect1>
|
||||||
|
<title>nix-prefetch-url</title>
|
||||||
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="nix-prefetch-url.xml" />
|
||||||
|
</sect1>
|
||||||
</appendix>
|
</appendix>
|
||||||
|
|
||||||
<xi:include href="troubleshooting.xml" />
|
<!-- &nix-lang-ref; -->
|
||||||
<!-- <xi:include href="bugs.xml" /> -->
|
|
||||||
<xi:include href="glossary.xml" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="troubleshooting.xml" />
|
||||||
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bugs.xml" />
|
||||||
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glossary.xml" />
|
||||||
|
|
||||||
<appendix>
|
|
||||||
<title>Nix Release Notes</title>
|
|
||||||
<xi:include href="release-notes.xml"
|
|
||||||
xpointer="xmlns(x=http://docbook.org/ns/docbook)xpointer(x:article/x:section)" />
|
|
||||||
</appendix>
|
|
||||||
|
|
||||||
</book>
|
</book>
|
||||||
@@ -1,15 +1,5 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
<refentry>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-build">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-build</refentrytitle>
|
|
||||||
<manvolnum>1</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
<refnamediv>
|
||||||
<refname>nix-build</refname>
|
<refname>nix-build</refname>
|
||||||
<refpurpose>build a Nix expression</refpurpose>
|
<refpurpose>build a Nix expression</refpurpose>
|
||||||
@@ -18,26 +8,8 @@
|
|||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>nix-build</command>
|
<command>nix-build</command>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(/db:nop/*)" />
|
|
||||||
<arg><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
|
|
||||||
<arg><option>--argstr</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
|
|
||||||
<arg>
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='plain'><option>--attr</option></arg>
|
|
||||||
<arg choice='plain'><option>-A</option></arg>
|
|
||||||
</group>
|
|
||||||
<replaceable>attrPath</replaceable>
|
|
||||||
</arg>
|
|
||||||
<arg><option>--add-drv-link</option></arg>
|
<arg><option>--add-drv-link</option></arg>
|
||||||
<arg><option>--drv-link </option><replaceable>drvlink</replaceable></arg>
|
<arg><option>--no-link</option></arg>
|
||||||
<arg><option>--no-out-link</option></arg>
|
|
||||||
<arg>
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='plain'><option>--out-link</option></arg>
|
|
||||||
<arg choice='plain'><option>-o</option></arg>
|
|
||||||
</group>
|
|
||||||
<replaceable>outlink</replaceable>
|
|
||||||
</arg>
|
|
||||||
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
|
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
@@ -53,17 +25,14 @@ to multiple derivations, multiple sequentially numbered symlinks are
|
|||||||
created (<filename>result</filename>, <filename>result-2</filename>,
|
created (<filename>result</filename>, <filename>result-2</filename>,
|
||||||
and so on).</para>
|
and so on).</para>
|
||||||
|
|
||||||
<para>If no <replaceable>paths</replaceable> are specified, then
|
<note><para><command>nix-build</command> is essentially a wrapper
|
||||||
<command>nix-build</command> will use <filename>default.nix</filename>
|
around <link
|
||||||
in the current directory, if it exists.</para>
|
|
||||||
|
|
||||||
<para><command>nix-build</command> is essentially a wrapper around
|
|
||||||
<link
|
|
||||||
linkend="sec-nix-instantiate"><command>nix-instantiate</command></link>
|
linkend="sec-nix-instantiate"><command>nix-instantiate</command></link>
|
||||||
(to translate a high-level Nix expression to a low-level store
|
(to translate a high-level Nix expression to a low-level store
|
||||||
derivation) and <link
|
derivation) and <link
|
||||||
linkend="rsec-nix-store-realise"><command>nix-store
|
linkend="rsec-nix-store-realise"><command>nix-store
|
||||||
--realise</command></link> (to build the store derivation).</para>
|
--realise</command></link> (to build the store
|
||||||
|
derivation).</para></note>
|
||||||
|
|
||||||
<warning><para>The result of the build is automatically registered as
|
<warning><para>The result of the build is automatically registered as
|
||||||
a root of the Nix garbage collector. This root disappears
|
a root of the Nix garbage collector. This root disappears
|
||||||
@@ -75,12 +44,6 @@ or renamed. So don’t rename the symlink.</para></warning>
|
|||||||
|
|
||||||
<refsection><title>Options</title>
|
<refsection><title>Options</title>
|
||||||
|
|
||||||
<para>See also <xref linkend="sec-common-options" />. All options not
|
|
||||||
listed here are passed to <command>nix-store --realise</command>,
|
|
||||||
except for <option>--arg</option> and <option>--attr</option> /
|
|
||||||
<option>-A</option> which are passed to
|
|
||||||
<command>nix-instantiate</command>.</para>
|
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry><term><option>--add-drv-link</option></term>
|
<varlistentry><term><option>--add-drv-link</option></term>
|
||||||
@@ -94,16 +57,7 @@ except for <option>--arg</option> and <option>--attr</option> /
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--drv-link</option> <replaceable>drvlink</replaceable></term>
|
<varlistentry><term><option>--no-link</option></term>
|
||||||
|
|
||||||
<listitem><para>Change the name of the symlink to the derivation
|
|
||||||
created when <option>--add-drv-link</option> is used from
|
|
||||||
<filename>derivation</filename> to
|
|
||||||
<replaceable>drvlink</replaceable>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--no-out-link</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Do not create a symlink to the output path. Note
|
<listitem><para>Do not create a symlink to the output path. Note
|
||||||
that as a result the output does not become a root of the garbage
|
that as a result the output does not become a root of the garbage
|
||||||
@@ -112,35 +66,9 @@ except for <option>--arg</option> and <option>--attr</option> /
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry xml:id='opt-out-link'><term><option>--out-link</option> /
|
|
||||||
<option>-o</option> <replaceable>outlink</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Change the name of the symlink to the output path
|
|
||||||
created unless <option>--no-out-link</option> is used from
|
|
||||||
<filename>result</filename> to
|
|
||||||
<replaceable>outlink</replaceable>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Examples</title>
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-build pkgs/top-level/all-packages.nix -A firefox
|
|
||||||
store derivation is /nix/store/qybprl8sz2lc...-firefox-1.5.0.7.drv
|
|
||||||
/nix/store/d18hyl92g30l...-firefox-1.5.0.7
|
|
||||||
|
|
||||||
$ ls -l result
|
|
||||||
lrwxrwxrwx <replaceable>...</replaceable> result -> /nix/store/d18hyl92g30l...-firefox-1.5.0.7
|
|
||||||
|
|
||||||
$ ls ./result/bin/
|
|
||||||
firefox firefox-config</screen>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
</refentry>
|
</refentry>
|
||||||
@@ -1,15 +1,5 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
<refentry>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-channel">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-channel</refentrytitle>
|
|
||||||
<manvolnum>1</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
<refnamediv>
|
||||||
<refname>nix-channel</refname>
|
<refname>nix-channel</refname>
|
||||||
<refpurpose>manage Nix channels</refpurpose>
|
<refpurpose>manage Nix channels</refpurpose>
|
||||||
@@ -63,11 +53,11 @@ also <xref linkend="sec-channels" />.</para>
|
|||||||
<varlistentry><term><option>--update</option></term>
|
<varlistentry><term><option>--update</option></term>
|
||||||
|
|
||||||
<listitem><para>Downloads the Nix expressions of all subscribed
|
<listitem><para>Downloads the Nix expressions of all subscribed
|
||||||
channels, makes them the default for <command>nix-env</command>
|
channels, makes the conjunction of these the default for
|
||||||
operations (by symlinking them in the directory
|
<command>nix-env</command> operations (by calling <command>nix-env
|
||||||
<filename>~/.nix-defexpr</filename>), and performs a
|
-I</command>), and performs a <command>nix-pull</command> on the
|
||||||
<command>nix-pull</command> on the manifests of all channels to
|
manifests of all channels to make pre-built binaries
|
||||||
make pre-built binaries available.</para></listitem>
|
available.</para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
<refentry>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-collect-garbage">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-collect-garbage</refentrytitle>
|
|
||||||
<manvolnum>1</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
<refnamediv>
|
||||||
<refname>nix-collect-garbage</refname>
|
<refname>nix-collect-garbage</refname>
|
||||||
<refpurpose>delete unreachable store paths</refpurpose>
|
<refpurpose>delete unreachable store paths</refpurpose>
|
||||||
@@ -18,8 +8,6 @@
|
|||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>nix-collect-garbage</command>
|
<command>nix-collect-garbage</command>
|
||||||
<arg><option>--delete-old</option></arg>
|
|
||||||
<arg><option>-d</option></arg>
|
|
||||||
<group choice='opt'>
|
<group choice='opt'>
|
||||||
<arg choice='plain'><option>--print-roots</option></arg>
|
<arg choice='plain'><option>--print-roots</option></arg>
|
||||||
<arg choice='plain'><option>--print-live</option></arg>
|
<arg choice='plain'><option>--print-live</option></arg>
|
||||||
@@ -31,28 +19,10 @@
|
|||||||
|
|
||||||
<refsection><title>Description</title>
|
<refsection><title>Description</title>
|
||||||
|
|
||||||
<para>The command <command>nix-collect-garbage</command> is mostly an
|
<para>The command <command>nix-collect-garbage</command> is an
|
||||||
alias of <link linkend="rsec-nix-store-gc"><command>nix-store
|
obsolete wrapper around <link
|
||||||
--gc</command></link>, that is, it deletes all unreachable paths in
|
linkend="rsec-nix-store-gc"><command>nix-store
|
||||||
the Nix store to clean up your system. However, it provides an
|
--gc</command></link>.</para>
|
||||||
additional option <option>-d</option> (<option>--delete-old</option>)
|
|
||||||
that deletes all old generations of all profiles in
|
|
||||||
<filename>/nix/var/nix/profiles</filename> by invoking
|
|
||||||
<literal>nix-env --delete-generations old</literal> on all profiles.
|
|
||||||
Of course, this makes rollbacks to previous configurations
|
|
||||||
impossible.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Example</title>
|
|
||||||
|
|
||||||
<para>To delete from the Nix store everything that is not used by the
|
|
||||||
current generations of each profile, do
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-collect-garbage -d</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
|
|||||||
@@ -1,152 +0,0 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-copy-closure">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-copy-closure</refentrytitle>
|
|
||||||
<manvolnum>1</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
|
||||||
<refname>nix-copy-closure</refname>
|
|
||||||
<refpurpose>copy a closure to or from a remote machine via SSH</refpurpose>
|
|
||||||
</refnamediv>
|
|
||||||
|
|
||||||
<refsynopsisdiv>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-copy-closure</command>
|
|
||||||
<group>
|
|
||||||
<arg choice='plain'><option>--to</option></arg>
|
|
||||||
<arg choice='plain'><option>--from</option></arg>
|
|
||||||
</group>
|
|
||||||
<arg><option>--sign</option></arg>
|
|
||||||
<arg><option>--gzip</option></arg>
|
|
||||||
<arg choice='plain'>
|
|
||||||
<arg><replaceable>user@</replaceable></arg><replaceable>machine</replaceable>
|
|
||||||
</arg>
|
|
||||||
<arg choice='plain'><replaceable>paths</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsynopsisdiv>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para><command>nix-copy-closure</command> gives you an easy and
|
|
||||||
efficient way to exchange software between machines. Given one or
|
|
||||||
more Nix store paths <replaceable>paths</replaceable> on the local
|
|
||||||
machine, <command>nix-copy-closure</command> computes the closure of
|
|
||||||
those paths (i.e. all their dependencies in the Nix store), and copies
|
|
||||||
all paths in the closure to the remote machine via the
|
|
||||||
<command>ssh</command> (Secure Shell) command. With the
|
|
||||||
<option>--from</option>, the direction is reversed:
|
|
||||||
the closure of <replaceable>paths</replaceable> on a remote machine is
|
|
||||||
copied to the Nix store on the local machine.</para>
|
|
||||||
|
|
||||||
<para>This command is efficient because it only sends the store paths
|
|
||||||
that are missing on the target machine.</para>
|
|
||||||
|
|
||||||
<para>Since <command>nix-copy-closure</command> calls
|
|
||||||
<command>ssh</command>, you may be asked to type in the appropriate
|
|
||||||
password or passphrase. In fact, you may be asked
|
|
||||||
<emphasis>twice</emphasis> because <command>nix-copy-closure</command>
|
|
||||||
currently connects twice to the remote machine, first to get the set
|
|
||||||
of paths missing on the target machine, and second to send the dump of
|
|
||||||
those paths. If this bothers you, use
|
|
||||||
<command>ssh-agent</command>.</para>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Options</title>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--to</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Copy the closure of
|
|
||||||
<replaceable>paths</replaceable> from the local Nix store to the
|
|
||||||
Nix store on <replaceable>machine</replaceable>. This is the
|
|
||||||
default.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--from</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Copy the closure of
|
|
||||||
<replaceable>paths</replaceable> from the Nix store on
|
|
||||||
<replaceable>machine</replaceable> to the local Nix
|
|
||||||
store.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--sign</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Let the sending machine cryptographically sign the
|
|
||||||
dump of each path with the key in
|
|
||||||
<filename>/nix/etc/nix/signing-key.sec</filename>. If the user on
|
|
||||||
the target machine does not have direct access to the Nix store
|
|
||||||
(i.e., if the target machine has a multi-user Nix installation),
|
|
||||||
then the target machine will check the dump against
|
|
||||||
<filename>/nix/etc/nix/signing-key.pub</filename> before unpacking
|
|
||||||
it in its Nix store. This allows secure sharing of store paths
|
|
||||||
between untrusted users on two machines, provided that there is a
|
|
||||||
trust relation between the Nix installations on both machines
|
|
||||||
(namely, they have matching public/secret keys).</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--gzip</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Compress the dump of each path with
|
|
||||||
<command>gzip</command> before sending it.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Environment variables</title>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
|
|
||||||
<varlistentry><term><envar>NIX_SSHOPTS</envar></term>
|
|
||||||
|
|
||||||
<listitem><para>Additional options to be passed to
|
|
||||||
<command>ssh</command> on the command line.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Examples</title>
|
|
||||||
|
|
||||||
<para>Copy Firefox with all its dependencies to a remote machine:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-copy-closure --to alice@itchy.labs $(type -tP firefox)</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>Copy Subversion from a remote machine and then install it into a
|
|
||||||
user environment:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-copy-closure --from alice@itchy.labs \
|
|
||||||
/nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4
|
|
||||||
$ nix-env -i /nix/store/0dj0503hjxy5mbwlafv1rsbdiyx1gkdy-subversion-1.4.4
|
|
||||||
</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
</refentry>
|
|
||||||
+93
-419
@@ -1,15 +1,5 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
<refentry>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-env">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-env</refentrytitle>
|
|
||||||
<manvolnum>1</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
<refnamediv>
|
||||||
<refname>nix-env</refname>
|
<refname>nix-env</refname>
|
||||||
<refpurpose>manipulate or query Nix user environments</refpurpose>
|
<refpurpose>manipulate or query Nix user environments</refpurpose>
|
||||||
@@ -18,9 +8,7 @@
|
|||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>nix-env</command>
|
<command>nix-env</command>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(/db:nop/*)" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
|
||||||
<arg><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
|
|
||||||
<arg><option>--argstr</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
|
|
||||||
<arg>
|
<arg>
|
||||||
<group choice='req'>
|
<group choice='req'>
|
||||||
<arg choice='plain'><option>--file</option></arg>
|
<arg choice='plain'><option>--file</option></arg>
|
||||||
@@ -35,11 +23,15 @@
|
|||||||
</group>
|
</group>
|
||||||
<replaceable>path</replaceable>
|
<replaceable>path</replaceable>
|
||||||
</arg>
|
</arg>
|
||||||
|
<arg><option>--preserve-installed</option></arg>
|
||||||
<arg>
|
<arg>
|
||||||
<arg choice='plain'><option>--system-filter</option></arg>
|
<arg choice='plain'><option>--system-filter</option></arg>
|
||||||
<replaceable>system</replaceable>
|
<replaceable>system</replaceable>
|
||||||
</arg>
|
</arg>
|
||||||
<arg><option>--dry-run</option></arg>
|
<arg><option>--dry-run</option></arg>
|
||||||
|
<arg><option>--from-expression</option></arg>
|
||||||
|
<arg><option>-E</option></arg>
|
||||||
|
<arg><option>--from-profile</option> <replaceable>path</replaceable></arg>
|
||||||
<arg choice='plain'><replaceable>operation</replaceable></arg>
|
<arg choice='plain'><replaceable>operation</replaceable></arg>
|
||||||
<arg rep='repeat'><replaceable>options</replaceable></arg>
|
<arg rep='repeat'><replaceable>options</replaceable></arg>
|
||||||
<arg rep='repeat'><replaceable>arguments</replaceable></arg>
|
<arg rep='repeat'><replaceable>arguments</replaceable></arg>
|
||||||
@@ -50,7 +42,7 @@
|
|||||||
<refsection><title>Description</title>
|
<refsection><title>Description</title>
|
||||||
|
|
||||||
<para>The command <command>nix-env</command> is used to manipulate Nix
|
<para>The command <command>nix-env</command> is used to manipulate Nix
|
||||||
user environments. User environments are sets of software packages
|
user environments. User environments are sets of software components
|
||||||
available to a user at some point in time. In other words, they are a
|
available to a user at some point in time. In other words, they are a
|
||||||
synthesised view of the programs available in the Nix store. There
|
synthesised view of the programs available in the Nix store. There
|
||||||
may be many user environments: different users can have different
|
may be many user environments: different users can have different
|
||||||
@@ -109,13 +101,21 @@ linkend="sec-common-options" />.</para>
|
|||||||
<option>--rollback</option> operations, this flag will cause
|
<option>--rollback</option> operations, this flag will cause
|
||||||
<command>nix-env</command> to print what
|
<command>nix-env</command> to print what
|
||||||
<emphasis>would</emphasis> be done if this flag had not been
|
<emphasis>would</emphasis> be done if this flag had not been
|
||||||
specified, without actually doing it.</para>
|
specified, without actually doing it.</para></listitem>
|
||||||
|
|
||||||
<para><option>--dry-run</option> also prints out which paths will
|
</varlistentry>
|
||||||
be <link linkend="gloss-substitute">substituted</link> (i.e.,
|
|
||||||
downloaded) and which paths will be built from source (because no
|
<varlistentry><term><option>--preserve-installed</option></term>
|
||||||
substitute is available).</para></listitem>
|
|
||||||
|
<listitem><para>By default, when you install a derivation with the
|
||||||
|
<option>--install</option> operation, it will replace previously
|
||||||
|
installed versions with the same derivation name (regardless of
|
||||||
|
the version number). This option causes those previously
|
||||||
|
installed versions to be kept in the new generation of the
|
||||||
|
profile. Note that this will generally cause conflicts in the
|
||||||
|
creation of the user environment (since multiple versions of a
|
||||||
|
package typically contain the same programs).</para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--system-filter</option> <replaceable>system</replaceable></term>
|
<varlistentry><term><option>--system-filter</option> <replaceable>system</replaceable></term>
|
||||||
@@ -142,34 +142,14 @@ linkend="sec-common-options" />.</para>
|
|||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry><term><filename>~/.nix-defexpr</filename></term>
|
<varlistentry><term><filename>~/.nix-defexpr</filename></term>
|
||||||
|
|
||||||
<listitem><para>A directory that contains the default Nix
|
<listitem><para>The default Nix expression used by the
|
||||||
expressions used by the <option>--install</option>,
|
<option>--install</option>, <option>--upgrade</option>, and
|
||||||
<option>--upgrade</option>, and <option>--query
|
<option>--query --available</option> operations to obtain
|
||||||
--available</option> operations to obtain derivations. The
|
derivations. It is generally a symbolic link to some other
|
||||||
|
location set using the <option>--import</option> operation. The
|
||||||
<option>--file</option> option may be used to override this
|
<option>--file</option> option may be used to override this
|
||||||
default.</para>
|
default.</para></listitem>
|
||||||
|
|
||||||
<para>The Nix expressions in this directory are combined into a
|
|
||||||
single attribute set, with each file as an attribute that has the
|
|
||||||
name of the file. Thus, if <filename>~/.nix-defexpr</filename>
|
|
||||||
contains two files, <filename>foo</filename> and
|
|
||||||
<filename>bar</filename>, then the default Nix expression will
|
|
||||||
essentially be
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
{
|
|
||||||
foo = import ~/.nix-defexpr/foo;
|
|
||||||
bar = import ~/.nix-defexpr/bar;
|
|
||||||
}</programlisting>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>The command <command>nix-channel</command> places symlinks
|
|
||||||
to the downloaded Nix expressions from each subscribed channel in
|
|
||||||
this directory.</para>
|
|
||||||
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -192,7 +172,7 @@ linkend="sec-common-options" />.</para>
|
|||||||
|
|
||||||
<!--######################################################################-->
|
<!--######################################################################-->
|
||||||
|
|
||||||
<refsection xml:id="rsec-nix-env-install"><title>Operation <option>--install</option></title>
|
<refsection id="rsec-nix-env-install"><title>Operation <option>--install</option></title>
|
||||||
|
|
||||||
<refsection><title>Synopsis</title>
|
<refsection><title>Synopsis</title>
|
||||||
|
|
||||||
@@ -202,7 +182,6 @@ linkend="sec-common-options" />.</para>
|
|||||||
<arg choice='plain'><option>--install</option></arg>
|
<arg choice='plain'><option>--install</option></arg>
|
||||||
<arg choice='plain'><option>-i</option></arg>
|
<arg choice='plain'><option>-i</option></arg>
|
||||||
</group>
|
</group>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-inst-syn.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(/db:nop/*)" />
|
|
||||||
<group choice='opt'>
|
<group choice='opt'>
|
||||||
<arg choice='plain'><option>--preserve-installed</option></arg>
|
<arg choice='plain'><option>--preserve-installed</option></arg>
|
||||||
<arg choice='plain'><option>-P</option></arg>
|
<arg choice='plain'><option>-P</option></arg>
|
||||||
@@ -229,34 +208,7 @@ number of possible ways:
|
|||||||
installed. Currently installed derivations with a name equal to the
|
installed. Currently installed derivations with a name equal to the
|
||||||
name of a derivation being added are removed unless the option
|
name of a derivation being added are removed unless the option
|
||||||
<option>--preserve-installed</option> is
|
<option>--preserve-installed</option> is
|
||||||
specified.</para>
|
specified.</para></listitem>
|
||||||
|
|
||||||
<para>If there are multiple derivations matching a name in
|
|
||||||
<replaceable>args</replaceable> that have the same name (e.g.,
|
|
||||||
<literal>gcc-3.3.6</literal> and <literal>gcc-4.1.1</literal>), then
|
|
||||||
the derivation with the highest <emphasis>priority</emphasis> is
|
|
||||||
used. A derivation can define a priority by declaring the
|
|
||||||
<varname>meta.priority</varname> attribute. This attribute should
|
|
||||||
be a number, with a higher value denoting a lower priority. The
|
|
||||||
default priority is <literal>0</literal>.</para>
|
|
||||||
|
|
||||||
<para>If there are multiple matching derivations with the same
|
|
||||||
priority, then the derivation with the highest version will be
|
|
||||||
installed.</para>
|
|
||||||
|
|
||||||
<para>You can force the installation of multiple derivations with
|
|
||||||
the same name by being specific about the versions. For instance,
|
|
||||||
<literal>nix-env -i gcc-3.3.6 gcc-4.1.1</literal> will install both
|
|
||||||
version of GCC (and will probably cause a user environment
|
|
||||||
conflict!).</para></listitem>
|
|
||||||
|
|
||||||
<listitem><para>If <link
|
|
||||||
linkend='opt-attr'><option>--attr</option></link>
|
|
||||||
(<option>-A</option>) is specified, the arguments are
|
|
||||||
<emphasis>attribute paths</emphasis> that select attributes from the
|
|
||||||
top-level Nix expression. This is faster than using derivation
|
|
||||||
names and unambiguous. To find out the attribute paths of available
|
|
||||||
packages, use <literal>nix-env -qaA '*'</literal>.</para></listitem>
|
|
||||||
|
|
||||||
<listitem><para>If <option>--from-profile</option>
|
<listitem><para>If <option>--from-profile</option>
|
||||||
<replaceable>path</replaceable> is given,
|
<replaceable>path</replaceable> is given,
|
||||||
@@ -295,15 +247,6 @@ number of possible ways:
|
|||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry><term><option>--prebuild-only</option> / <option>-b</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Use only derivations for which a substitute is
|
|
||||||
registered, i.e., there is a pre-built binary available that can
|
|
||||||
be downloaded in lieu of building the derivation. Thus, no
|
|
||||||
packages will be built from source.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--preserve-installed</option></term>
|
<varlistentry><term><option>--preserve-installed</option></term>
|
||||||
<term><option>-P</option></term>
|
<term><option>-P</option></term>
|
||||||
|
|
||||||
@@ -321,7 +264,7 @@ number of possible ways:
|
|||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
<refsection xml:id='refsec-nix-env-install-examples'><title>Examples</title>
|
<refsection><title>Examples</title>
|
||||||
|
|
||||||
<para>To install a specific version of <command>gcc</command> from the
|
<para>To install a specific version of <command>gcc</command> from the
|
||||||
active Nix expression:
|
active Nix expression:
|
||||||
@@ -342,14 +285,6 @@ installing `gcc-3.3.2'</screen>
|
|||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>To install using a specific attribute:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-env -i -A gcc40mips
|
|
||||||
$ nix-env -i -A xorg.xorgserver</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>To install all derivations in the Nix expression <filename>foo.nix</filename>:
|
<para>To install all derivations in the Nix expression <filename>foo.nix</filename>:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
@@ -376,7 +311,7 @@ $ nix-env -i /nix/store/fibjb1bfbpm5mrsxc4mh2d8n37sxh91i-gcc-3.4.3.drv</screen>
|
|||||||
<para>To install a specific output path:
|
<para>To install a specific output path:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-env -i /nix/store/y3cgx0xj1p4iv9x0pnnmdhr8iyg741vk-gcc-3.4.3</screen>
|
$ nix-env -i /nix/store/x3cgx0xj1p4iv9x0pnnmdhr8iyg741vk-gcc-3.4.3</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@@ -392,25 +327,6 @@ selecting the <literal>subversionWithJava</literal> attribute from the
|
|||||||
attribute set returned by calling the function defined in
|
attribute set returned by calling the function defined in
|
||||||
<filename>./foo.nix</filename>.</para>
|
<filename>./foo.nix</filename>.</para>
|
||||||
|
|
||||||
<para>A dry-run tells you which paths will be downloaded or built from
|
|
||||||
source:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-env -f pkgs/top-level/all-packages.nix -i f-spot --dry-run
|
|
||||||
(dry run; not doing anything)
|
|
||||||
installing `f-spot-0.0.10'
|
|
||||||
the following derivations will be built:
|
|
||||||
/nix/store/0g63jv9aagwbgci4nnzs2dkxqz84kdja-libgnomeprintui-2.12.1.tar.bz2.drv
|
|
||||||
/nix/store/0gfarvxq6sannsdw8a1ir40j1ys2mqb4-ORBit2-2.14.2.tar.bz2.drv
|
|
||||||
/nix/store/0i9gs5zc04668qiy60ga2rc16abkj7g8-sqlite-2.8.17.drv
|
|
||||||
<replaceable>...</replaceable>
|
|
||||||
the following paths will be substituted:
|
|
||||||
/nix/store/8zbipvm4gp9jfqh9nnk1n3bary1a37gs-perl-XML-Parser-2.34
|
|
||||||
/nix/store/b8a2bg7gnyvvvjjibp4axg9x1hzkw36c-mono-1.1.4
|
|
||||||
<replaceable>...</replaceable></screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
@@ -419,7 +335,7 @@ the following paths will be substituted:
|
|||||||
|
|
||||||
<!--######################################################################-->
|
<!--######################################################################-->
|
||||||
|
|
||||||
<refsection xml:id="rsec-nix-env-upgrade"><title>Operation <option>--upgrade</option></title>
|
<refsection><title>Operation <option>--upgrade</option></title>
|
||||||
|
|
||||||
<refsection><title>Synopsis</title>
|
<refsection><title>Synopsis</title>
|
||||||
|
|
||||||
@@ -429,11 +345,9 @@ the following paths will be substituted:
|
|||||||
<arg choice='plain'><option>--upgrade</option></arg>
|
<arg choice='plain'><option>--upgrade</option></arg>
|
||||||
<arg choice='plain'><option>-u</option></arg>
|
<arg choice='plain'><option>-u</option></arg>
|
||||||
</group>
|
</group>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-inst-syn.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(/db:nop/*)" />
|
|
||||||
<group choice='opt'>
|
<group choice='opt'>
|
||||||
<arg choice='plain'><option>--lt</option></arg>
|
<arg choice='plain'><option>--lt</option></arg>
|
||||||
<arg choice='plain'><option>--leq</option></arg>
|
<arg choice='plain'><option>--leq</option></arg>
|
||||||
<arg choice='plain'><option>--eq</option></arg>
|
|
||||||
<arg choice='plain'><option>--always</option></arg>
|
<arg choice='plain'><option>--always</option></arg>
|
||||||
</group>
|
</group>
|
||||||
<arg choice='plain' rep='repeat'><replaceable>args</replaceable></arg>
|
<arg choice='plain' rep='repeat'><replaceable>args</replaceable></arg>
|
||||||
@@ -482,17 +396,6 @@ installed.</para>
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--eq</option></term>
|
|
||||||
|
|
||||||
<listitem><para><emphasis>Only</emphasis> “upgrade” to derivations
|
|
||||||
that have the same version. This may not seem very useful, but it
|
|
||||||
actually is, e.g., when there is a new release of Nixpkgs and you
|
|
||||||
want to replace installed applications with the same versions
|
|
||||||
built against newer dependencies (to reduce the number of
|
|
||||||
dependencies floating around on your system).</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--always</option></term>
|
<varlistentry><term><option>--always</option></term>
|
||||||
|
|
||||||
<listitem><para>In addition to upgrading to newer versions, also
|
<listitem><para>In addition to upgrading to newer versions, also
|
||||||
@@ -504,9 +407,6 @@ installed.</para>
|
|||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
<para>For the other flags, see <option
|
|
||||||
linkend="rsec-nix-env-install">--install</option>.</para>
|
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
<refsection><title>Examples</title>
|
<refsection><title>Examples</title>
|
||||||
@@ -527,7 +427,7 @@ upgrading `mozilla-1.2' to `mozilla-1.4'</screen>
|
|||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
<refsection xml:id="ssec-version-comparisons"><title>Versions</title>
|
<refsection><title>Versions</title>
|
||||||
|
|
||||||
<para>The upgrade operation determines whether a derivation
|
<para>The upgrade operation determines whether a derivation
|
||||||
<varname>y</varname> is an upgrade of a derivation
|
<varname>y</varname> is an upgrade of a derivation
|
||||||
@@ -616,111 +516,6 @@ $ nix-env -e '*' <lineannotation>(remove everything)</lineannotation></screen>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--######################################################################-->
|
|
||||||
|
|
||||||
<refsection xml:id="rsec-nix-env-set-flag"><title>Operation <option>--set-flag</option></title>
|
|
||||||
|
|
||||||
<refsection><title>Synopsis</title>
|
|
||||||
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-env</command>
|
|
||||||
<arg choice='plain'><option>--set-flag</option></arg>
|
|
||||||
<arg choice='plain'><replaceable>name</replaceable></arg>
|
|
||||||
<arg choice='plain'><replaceable>value</replaceable></arg>
|
|
||||||
<arg choice='plain' rep='repeat'><replaceable>drvnames</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The <option>--set-flag</option> operation allows meta attributes
|
|
||||||
of installed packages to be modified. There are several attributes
|
|
||||||
that can be usefully modified, because they affect the behaviour of
|
|
||||||
<command>nix-env</command> or the user environment build
|
|
||||||
script:
|
|
||||||
|
|
||||||
<itemizedlist>
|
|
||||||
|
|
||||||
<listitem><para><varname>priority</varname> can be changed to
|
|
||||||
resolve filename clashes. The user environment build script uses
|
|
||||||
the <varname>meta.priority</varname> attribute of derivations to
|
|
||||||
resolve filename collisions between packages. Lower priority values
|
|
||||||
denote a higher priority. For instance, the GCC wrapper package and
|
|
||||||
the Binutils package in Nixpkgs both have a file
|
|
||||||
<filename>bin/ld</filename>, so previously if you tried to install
|
|
||||||
both you would get a collision. Now, on the other hand, the GCC
|
|
||||||
wrapper declares a higher priority than Binutils, so the former’s
|
|
||||||
<filename>bin/ld</filename> is symlinked in the user
|
|
||||||
environment.</para></listitem>
|
|
||||||
|
|
||||||
<listitem><para><varname>keep</varname> can be set to
|
|
||||||
<literal>true</literal> to prevent the package from being upgraded
|
|
||||||
or replaced. This is useful if you want to hang on to an older
|
|
||||||
version of a package.</para></listitem>
|
|
||||||
|
|
||||||
<listitem><para><varname>active</varname> can be set to
|
|
||||||
<literal>false</literal> to “disable” the package. That is, no
|
|
||||||
symlinks will be generated to the files of the package, but it
|
|
||||||
remains part of the profile (so it won’t be garbage-collected). It
|
|
||||||
can be set back to <literal>true</literal> to re-enable the
|
|
||||||
package.</para></listitem>
|
|
||||||
|
|
||||||
</itemizedlist>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Examples</title>
|
|
||||||
|
|
||||||
<para>To prevent the currently installed Firefox from being upgraded:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-env --set-flag keep true firefox</screen>
|
|
||||||
|
|
||||||
After this, <command>nix-env -u</command> will ignore Firefox.</para>
|
|
||||||
|
|
||||||
<para>To disable the currently installed Firefox, then install a new
|
|
||||||
Firefox while the old remains part of the profile:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-env -q \*
|
|
||||||
firefox-2.0.0.9 <lineannotation>(the current one)</lineannotation>
|
|
||||||
|
|
||||||
$ nix-env --preserve-installed -i firefox-2.0.0.11
|
|
||||||
installing `firefox-2.0.0.11'
|
|
||||||
building path(s) `/nix/store/myy0y59q3ig70dgq37jqwg1j0rsapzsl-user-environment'
|
|
||||||
Collission between `/nix/store/<replaceable>...</replaceable>-firefox-2.0.0.11/bin/firefox'
|
|
||||||
and `/nix/store/<replaceable>...</replaceable>-firefox-2.0.0.9/bin/firefox'.
|
|
||||||
<lineannotation>(i.e., can’t have two active at the same time)</lineannotation>
|
|
||||||
|
|
||||||
$ nix-env --set-flag active false firefox
|
|
||||||
setting flag on `firefox-2.0.0.9'
|
|
||||||
|
|
||||||
$ nix-env --preserve-installed -i firefox-2.0.0.11
|
|
||||||
installing `firefox-2.0.0.11'
|
|
||||||
|
|
||||||
$ nix-env -q \*
|
|
||||||
firefox-2.0.0.11 <lineannotation>(the enabled one)</lineannotation>
|
|
||||||
firefox-2.0.0.9 <lineannotation>(the disabled one)</lineannotation></screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>To make files from <literal>binutils</literal> take precedence
|
|
||||||
over files from <literal>gcc</literal>:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-env --set-flag priority 5 binutils
|
|
||||||
$ nix-env --set-flag priority 10 gcc</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--######################################################################-->
|
<!--######################################################################-->
|
||||||
|
|
||||||
<refsection><title>Operation <option>--query</option></title>
|
<refsection><title>Operation <option>--query</option></title>
|
||||||
@@ -738,55 +533,12 @@ $ nix-env --set-flag priority 10 gcc</screen>
|
|||||||
<arg choice='plain'><option>--available</option></arg>
|
<arg choice='plain'><option>--available</option></arg>
|
||||||
<arg choice='plain'><option>-a</option></arg>
|
<arg choice='plain'><option>-a</option></arg>
|
||||||
</group>
|
</group>
|
||||||
|
<group choice='req'>
|
||||||
<sbr />
|
<arg choice='plain'><option>--name</option></arg>
|
||||||
|
<arg choice='plain'><option>--expr</option></arg>
|
||||||
<arg>
|
<arg choice='plain'><option>--status</option></arg>
|
||||||
<group choice='req'>
|
<arg choice='plain'><option>-s</option></arg>
|
||||||
<arg choice='plain'><option>--status</option></arg>
|
</group>
|
||||||
<arg choice='plain'><option>-s</option></arg>
|
|
||||||
</group>
|
|
||||||
</arg>
|
|
||||||
<arg>
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='plain'><option>--attr-path</option></arg>
|
|
||||||
<arg choice='plain'><option>-P</option></arg>
|
|
||||||
</group>
|
|
||||||
</arg>
|
|
||||||
<arg><option>--no-name</option></arg>
|
|
||||||
<arg>
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='plain'><option>--compare-versions</option></arg>
|
|
||||||
<arg choice='plain'><option>-c</option></arg>
|
|
||||||
</group>
|
|
||||||
</arg>
|
|
||||||
<arg><option>--system</option></arg>
|
|
||||||
<arg><option>--drv-path</option></arg>
|
|
||||||
<arg><option>--out-path</option></arg>
|
|
||||||
<arg><option>--description</option></arg>
|
|
||||||
<arg><option>--meta</option></arg>
|
|
||||||
|
|
||||||
<sbr />
|
|
||||||
|
|
||||||
<arg><option>--xml</option></arg>
|
|
||||||
<arg>
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='plain'><option>--prebuilt-only</option></arg>
|
|
||||||
<arg choice='plain'><option>-b</option></arg>
|
|
||||||
</group>
|
|
||||||
</arg>
|
|
||||||
|
|
||||||
<arg>
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='plain'><option>--attr</option></arg>
|
|
||||||
<arg choice='plain'><option>-A</option></arg>
|
|
||||||
</group>
|
|
||||||
<replaceable>attribute-path</replaceable>
|
|
||||||
</arg>
|
|
||||||
|
|
||||||
<sbr />
|
|
||||||
|
|
||||||
<arg choice='plain' rep='repeat'><replaceable>names</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
@@ -798,10 +550,7 @@ $ nix-env --set-flag priority 10 gcc</screen>
|
|||||||
paths that are installed in the current generation of the active
|
paths that are installed in the current generation of the active
|
||||||
profile (<option>--installed</option>), or the derivations that are
|
profile (<option>--installed</option>), or the derivations that are
|
||||||
available for installation in the active Nix expression
|
available for installation in the active Nix expression
|
||||||
(<option>--available</option>). It only prints information about
|
(<option>--available</option>).</para>
|
||||||
derivations whose symbolic name matches one of
|
|
||||||
<replaceable>names</replaceable>. The wildcard <literal>*</literal>
|
|
||||||
shows all derivations.</para>
|
|
||||||
|
|
||||||
<para>The derivations are sorted by their <literal>name</literal>
|
<para>The derivations are sorted by their <literal>name</literal>
|
||||||
attributes.</para>
|
attributes.</para>
|
||||||
@@ -850,28 +599,6 @@ user environment elements, etc. -->
|
|||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry><term><option>--xml</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Print the result in an XML representation suitable
|
|
||||||
for automatic processing by other tools. The root element is
|
|
||||||
called <literal>items</literal>, which contains a
|
|
||||||
<literal>item</literal> element for each available or installed
|
|
||||||
derivation. The fields discussed below are all stored in
|
|
||||||
attributes of the <literal>item</literal>
|
|
||||||
elements.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--prebuild-only</option> / <option>-b</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Show only derivations for which a substitute is
|
|
||||||
registered, i.e., there is a pre-built binary available that can
|
|
||||||
be downloaded in lieu of building the derivation. Thus, this
|
|
||||||
shows all packages that probably can be installed
|
|
||||||
quickly.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--status</option></term>
|
<varlistentry><term><option>--status</option></term>
|
||||||
<term><option>-s</option></term>
|
<term><option>-s</option></term>
|
||||||
|
|
||||||
@@ -891,17 +618,6 @@ user environment elements, etc. -->
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--attr-path</option></term>
|
|
||||||
<term><option>-P</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Print the <emphasis>attribute path</emphasis> of
|
|
||||||
the derivation, which can be used to unambiguously select it using
|
|
||||||
the <link linkend="opt-attr"><option>--attr</option> option</link>
|
|
||||||
available in commands that install derivations like
|
|
||||||
<literal>nix-env --install</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--no-name</option></term>
|
<varlistentry><term><option>--no-name</option></term>
|
||||||
|
|
||||||
<listitem><para>Suppress printing of the <literal>name</literal>
|
<listitem><para>Suppress printing of the <literal>name</literal>
|
||||||
@@ -909,51 +625,6 @@ user environment elements, etc. -->
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--compare-versions</option> /
|
|
||||||
<option>-c</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Compare installed versions to available versions,
|
|
||||||
or vice versa (if <option>--available</option> is given). This is
|
|
||||||
useful for quickly seeing whether upgrades for installed
|
|
||||||
packages are available in a Nix expression. A column is added
|
|
||||||
with the following meaning:
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
|
|
||||||
<varlistentry><term><literal><</literal> <replaceable>version</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>A newer version of the package is available
|
|
||||||
or installed.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><literal>=</literal> <replaceable>version</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>At most the same version of the package is
|
|
||||||
available or installed.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><literal>></literal> <replaceable>version</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Only older versions of the package are
|
|
||||||
available or installed.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><literal>- ?</literal></term>
|
|
||||||
|
|
||||||
<listitem><para>No version of the package is available or
|
|
||||||
installed.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--system</option></term>
|
<varlistentry><term><option>--system</option></term>
|
||||||
|
|
||||||
<listitem><para>Print the <literal>system</literal> attribute of
|
<listitem><para>Print the <literal>system</literal> attribute of
|
||||||
@@ -975,23 +646,6 @@ user environment elements, etc. -->
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--description</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Print a short (one-line) description of the
|
|
||||||
derivation, if available. The description is taken from the
|
|
||||||
<literal>meta.description</literal> attribute of the
|
|
||||||
derivation.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--meta</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Print all of the meta-attributes of the
|
|
||||||
derivation. This option is only available with
|
|
||||||
<option>--xml</option>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
@@ -1000,47 +654,28 @@ user environment elements, etc. -->
|
|||||||
<refsection><title>Examples</title>
|
<refsection><title>Examples</title>
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-env -q '*' <lineannotation>(show installed derivations)</lineannotation>
|
$ nix-env -q <lineannotation>(show installed derivations)</lineannotation>
|
||||||
|
MozillaFirebird-0.7
|
||||||
bison-1.875c
|
bison-1.875c
|
||||||
docbook-xml-4.2
|
docbook-xml-4.2
|
||||||
firefox-1.0.4
|
|
||||||
MPlayer-1.0pre7
|
|
||||||
ORBit2-2.8.3
|
|
||||||
...
|
...
|
||||||
|
|
||||||
$ nix-env -qa '*' <lineannotation>(show available derivations)</lineannotation>
|
$ nix-env -qa <lineannotation>(show available derivations)</lineannotation>
|
||||||
firefox-1.0.7
|
|
||||||
GConf-2.4.0.1
|
GConf-2.4.0.1
|
||||||
MPlayer-1.0pre7
|
MPlayer-1.0pre3
|
||||||
|
MozillaFirebird-0.7
|
||||||
ORBit2-2.8.3
|
ORBit2-2.8.3
|
||||||
...
|
...
|
||||||
|
|
||||||
$ nix-env -qas '*' <lineannotation>(show status of available derivations)</lineannotation>
|
$ nix-env -qas <lineannotation>(show status of available derivations)</lineannotation>
|
||||||
-P- firefox-1.0.7 <lineannotation>(not installed but present)</lineannotation>
|
-P- GConf-2.4.0.1 <lineannotation>(not installed but present)</lineannotation>
|
||||||
--S GConf-2.4.0.1 <lineannotation>(not present, but there is a substitute for fast installation)</lineannotation>
|
--S MPlayer-1.0pre3 <lineannotation>(not present, but there is a substitute for fast installation)</lineannotation>
|
||||||
--S MPlayer-1.0pre3 <lineannotation>(i.e., this is not the installed MPlayer, even though the version is the same!)</lineannotation>
|
--S MozillaFirebird-0.7 <lineannotation>(i.e., this is not the installed Firebird, even though the version is the same!)</lineannotation>
|
||||||
IP- ORBit2-2.8.3 <lineannotation>(installed and by definition present)</lineannotation>
|
IP- bison-1.875c <lineannotation>(installed and by definition present)</lineannotation>
|
||||||
...
|
...
|
||||||
|
|
||||||
<lineannotation>(show available derivations in the Nix expression <!-- !!! <filename>-->foo.nix<!-- </filename> -->)</lineannotation>
|
$ nix-env -f ./foo.nix -qa <lineannotation>(show available derivations in the Nix expression <filename>foo.nix</filename>)</lineannotation>
|
||||||
$ nix-env -f ./foo.nix -qa '*'
|
foo-1.2.3</screen>
|
||||||
foo-1.2.3
|
|
||||||
|
|
||||||
$ nix-env -qc '*' <lineannotation>(compare installed versions to what’s available)</lineannotation>
|
|
||||||
<replaceable>...</replaceable>
|
|
||||||
acrobat-reader-7.0 - ? <lineannotation>(package is not available at all)</lineannotation>
|
|
||||||
autoconf-2.59 = 2.59 <lineannotation>(same version)</lineannotation>
|
|
||||||
firefox-1.0.4 < 1.0.7 <lineannotation>(a more recent version is available)</lineannotation>
|
|
||||||
<replaceable>...</replaceable>
|
|
||||||
|
|
||||||
<lineannotation>(show info about a specific package, in XML)</lineannotation>
|
|
||||||
$ nix-env -qa --xml --description firefox
|
|
||||||
<![CDATA[<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<items>
|
|
||||||
<item attrPath="0.0.firefoxWrapper"
|
|
||||||
description="Mozilla Firefox - the browser, reloaded (with various plugins)"
|
|
||||||
name="firefox-1.5.0.7" system="i686-linux" />
|
|
||||||
</items>]]></screen>
|
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
@@ -1251,4 +886,43 @@ error: no generation older than the current (91) exists</screen>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--######################################################################-->
|
||||||
|
|
||||||
|
<refsection><title>Operation <option>--import</option></title>
|
||||||
|
|
||||||
|
<refsection><title>Synopsis</title>
|
||||||
|
|
||||||
|
<cmdsynopsis>
|
||||||
|
<command>nix-env</command>
|
||||||
|
<group choice='req'>
|
||||||
|
<arg choice='plain'><option>--import</option></arg>
|
||||||
|
<arg choice='plain'><option>-I</option></arg>
|
||||||
|
</group>
|
||||||
|
<arg choice='req'><replaceable>path</replaceable></arg>
|
||||||
|
</cmdsynopsis>
|
||||||
|
|
||||||
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
|
<refsection><title>Description</title>
|
||||||
|
|
||||||
|
<para>This operation makes <replaceable>path</replaceable> the default
|
||||||
|
active Nix expression for the user. That is, the symlink
|
||||||
|
<filename>~/.nix-userenv</filename> is made to point to
|
||||||
|
<replaceable>path</replaceable>.</para>
|
||||||
|
|
||||||
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
|
<refsection><title>Examples</title>
|
||||||
|
|
||||||
|
<screen>
|
||||||
|
$ nix-env -I ~/nixpkgs-0.5/</screen>
|
||||||
|
|
||||||
|
</refsection>
|
||||||
|
|
||||||
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</refentry>
|
</refentry>
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-hash">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-hash</refentrytitle>
|
|
||||||
<manvolnum>1</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
|
||||||
<refname>nix-hash</refname>
|
|
||||||
<refpurpose>compute the cryptographic hash of a path</refpurpose>
|
|
||||||
</refnamediv>
|
|
||||||
|
|
||||||
<refsynopsisdiv>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-hash</command>
|
|
||||||
<arg><option>--flat</option></arg>
|
|
||||||
<arg><option>--base32</option></arg>
|
|
||||||
<arg><option>--truncate</option></arg>
|
|
||||||
<arg><option>--type</option> <replaceable>hashAlgo</replaceable></arg>
|
|
||||||
<arg choice='plain' rep='repeat'><replaceable>path</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-hash</command>
|
|
||||||
<arg choice='plain'><option>--to-base16</option></arg>
|
|
||||||
<arg choice='plain' rep='repeat'><replaceable>hash</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-hash</command>
|
|
||||||
<arg choice='plain'><option>--to-base32</option></arg>
|
|
||||||
<arg choice='plain' rep='repeat'><replaceable>hash</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsynopsisdiv>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The command <command>nix-hash</command> computes the
|
|
||||||
cryptographic hash of the contents of each
|
|
||||||
<replaceable>path</replaceable> and prints it on standard output. By
|
|
||||||
default, it computes an MD5 hash, but other hash algorithms are
|
|
||||||
available as well. The hash is printed in hexadecimal.</para>
|
|
||||||
|
|
||||||
<para>The hash is computed over a <emphasis>serialisation</emphasis>
|
|
||||||
of each path: a dump of the file system tree rooted at the path. This
|
|
||||||
allows directories and symlinks to be hashed as well as regular files.
|
|
||||||
The dump is in the <emphasis>NAR format</emphasis> produced by <link
|
|
||||||
linkend="refsec-nix-store-dump"><command>nix-store</command>
|
|
||||||
<option>--dump</option></link>. Thus, <literal>nix-hash
|
|
||||||
<replaceable>path</replaceable></literal> yields the same
|
|
||||||
cryptographic hash as <literal>nix-store --dump
|
|
||||||
<replaceable>path</replaceable> | md5sum</literal>.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Options</title>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--flat</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Print the cryptographic hash of the contents of
|
|
||||||
each regular file <replaceable>path</replaceable>. That is, do
|
|
||||||
not compute the hash over the dump of
|
|
||||||
<replaceable>path</replaceable>. The result is identical to that
|
|
||||||
produced by the GNU commands <command>md5sum</command> and
|
|
||||||
<command>sha1sum</command>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--base32</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Print the hash in a base-32 representation rather
|
|
||||||
than hexadecimal. This base-32 representation is more compact and
|
|
||||||
can be used in Nix expressions (such as in calls to
|
|
||||||
<function>fetchurl</function>).</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--truncate</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Truncate hashes longer than 160 bits (such as
|
|
||||||
SHA-256) to 160 bits.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--type</option> <replaceable>hashAlgo</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Specify a cryptographic hash, which can be one of
|
|
||||||
<literal>md5</literal>, <literal>sha1</literal>, and
|
|
||||||
<literal>sha256</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--to-base16</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Don’t hash anything, but convert the base-32 hash
|
|
||||||
representation <replaceable>hash</replaceable> to
|
|
||||||
hexadecimal.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--to-base32</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Don’t hash anything, but convert the hexadecimal
|
|
||||||
hash representation <replaceable>hash</replaceable> to
|
|
||||||
base-32.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Examples</title>
|
|
||||||
|
|
||||||
<para>Computing hashes:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ mkdir test
|
|
||||||
$ echo "hello" > test/world
|
|
||||||
|
|
||||||
$ nix-hash test/ <lineannotation>(MD5 hash; default)</lineannotation>
|
|
||||||
8179d3caeff1869b5ba1744e5a245c04
|
|
||||||
|
|
||||||
$ nix-store --dump test/ | md5sum <lineannotation>(for comparison)</lineannotation>
|
|
||||||
8179d3caeff1869b5ba1744e5a245c04 -
|
|
||||||
|
|
||||||
$ nix-hash --type sha1 test/
|
|
||||||
e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6
|
|
||||||
|
|
||||||
$ nix-hash --type sha1 --base32 test/
|
|
||||||
nvd61k9nalji1zl9rrdfmsmvyyjqpzg4
|
|
||||||
|
|
||||||
$ nix-hash --type sha256 --flat test/
|
|
||||||
error: reading file `test/': Is a directory
|
|
||||||
|
|
||||||
$ nix-hash --type sha256 --flat test/world
|
|
||||||
5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>Converting between hexadecimal and base-32:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-hash --type sha1 --to-base32 e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6
|
|
||||||
nvd61k9nalji1zl9rrdfmsmvyyjqpzg4
|
|
||||||
|
|
||||||
$ nix-hash --type sha1 --to-base16 nvd61k9nalji1zl9rrdfmsmvyyjqpzg4
|
|
||||||
e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
</refentry>
|
|
||||||
@@ -1,198 +0,0 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-install-package">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-install-package</refentrytitle>
|
|
||||||
<manvolnum>1</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
|
||||||
<refname>nix-install-package</refname>
|
|
||||||
<refpurpose>install a Nix Package file</refpurpose>
|
|
||||||
</refnamediv>
|
|
||||||
|
|
||||||
<refsynopsisdiv>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-install-package</command>
|
|
||||||
<arg><option>--non-interactive</option></arg>
|
|
||||||
<arg>
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='plain'><option>--profile</option></arg>
|
|
||||||
<arg choice='plain'><option>-p</option></arg>
|
|
||||||
</group>
|
|
||||||
<replaceable>path</replaceable>
|
|
||||||
</arg>
|
|
||||||
<sbr />
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='req'>
|
|
||||||
<option>--url</option>
|
|
||||||
<arg choice='plain'><replaceable>url</replaceable></arg>
|
|
||||||
</arg>
|
|
||||||
<arg choice='req'>
|
|
||||||
<arg choice='plain'><replaceable>file</replaceable></arg>
|
|
||||||
</arg>
|
|
||||||
</group>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsynopsisdiv>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The command <command>nix-install-package</command> interactively
|
|
||||||
installs a Nix Package file (<filename>*.nixpkg</filename>), which is
|
|
||||||
a small file that contains a store path to be installed along with the
|
|
||||||
URL of a <link linkend="sec-nix-push"><command>nix-push</command>
|
|
||||||
manifest</link>. The Nix Package file is either
|
|
||||||
<replaceable>file</replaceable>, or automatically downloaded from
|
|
||||||
<replaceable>url</replaceable> if the <option>--url</option> switch is
|
|
||||||
used.</para>
|
|
||||||
|
|
||||||
<para><command>nix-install-package</command> is used in <link
|
|
||||||
linkend="sec-one-click">one-click installs</link> to download and
|
|
||||||
install pre-built binary packages with all necessary dependencies.
|
|
||||||
<command>nix-install-package</command> is intended to be associated
|
|
||||||
with the MIME type <literal>application/nix-package</literal> in a web
|
|
||||||
browser so that it is invoked automatically when you click on
|
|
||||||
<filename>*.nixpkg</filename> files. When invoked, it restarts itself
|
|
||||||
in a terminal window (since otherwise it would be invisible when run
|
|
||||||
from a browser), asks the user to confirm whether to install the
|
|
||||||
package, and if so downloads and installs the package into the user’s
|
|
||||||
current profile.</para>
|
|
||||||
|
|
||||||
<para>To obtain a window, <command>nix-install-package</command> tries
|
|
||||||
to restart itself with <command>xterm</command>,
|
|
||||||
<command>konsole</command> and
|
|
||||||
<command>gnome-terminal</command>.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Options</title>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--non-interactive</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Do not open a new terminal window and do not ask
|
|
||||||
for confirmation.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--profile</option></term>
|
|
||||||
<term><option>-p</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Install the package into the specified profile
|
|
||||||
rather than the user’s current profile.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Examples</title>
|
|
||||||
|
|
||||||
<para>To install <filename>subversion-1.4.0.nixpkg</filename> into the
|
|
||||||
user’s current profile, without any prompting:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-install-package --non-interactive subversion-1.4.0.nixpkg</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>To install the same package from some URL into a different
|
|
||||||
profile:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-install-package --non-interactive -p /nix/var/nix/profiles/eelco \
|
|
||||||
--url http://nix.cs.uu.nl/dist/nix/nixpkgs-0.10pre6622/pkgs/subversion-1.4.0-i686-linux.nixpkg</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Format of <literal>nixpkg</literal> files</title>
|
|
||||||
|
|
||||||
<para>A Nix Package file consists of a single line with the following
|
|
||||||
format:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
NIXPKG1 <replaceable>manifestURL</replaceable> <replaceable>name</replaceable> <replaceable>system</replaceable> <replaceable>drvPath</replaceable> <replaceable>outPath</replaceable></screen>
|
|
||||||
|
|
||||||
The elemens are as follows:
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
|
|
||||||
<varlistentry><term><literal>NIXPKG1</literal></term>
|
|
||||||
|
|
||||||
<listitem><para>The version of the Nix Package
|
|
||||||
file.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><replaceable>manifestURL</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>The manifest to be pulled by
|
|
||||||
<command>nix-pull</command>. The manifest must contain
|
|
||||||
<replaceable>outPath</replaceable>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><replaceable>name</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>The symbolic name and version of the
|
|
||||||
package.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><replaceable>system</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>The platform identifier of the platform for which
|
|
||||||
this binary package is intended.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><replaceable>drvPath</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>The path in the Nix store of the derivation from
|
|
||||||
which <replaceable>outPath</replaceable> was built. Not currently
|
|
||||||
used.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><replaceable>outPath</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>The path in the Nix store of the package. After
|
|
||||||
<command>nix-install-package</command> has obtained the manifest
|
|
||||||
from <replaceable>manifestURL</replaceable>, it performs a
|
|
||||||
<literal>nix-env -i</literal> <replaceable>outPath</replaceable>
|
|
||||||
to install the binary package.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>An example follows:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
NIXPKG1 http://.../nixpkgs-0.10pre6622/MANIFEST subversion-1.4.0 i686-darwin \
|
|
||||||
/nix/store/4kh60jkp...-subversion-1.4.0.drv \
|
|
||||||
/nix/store/nkw7wpgb...-subversion-1.4.0</screen>
|
|
||||||
|
|
||||||
(The line breaks (<literal>\</literal>) are for presentation purposes
|
|
||||||
and not part of the actual file.)
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
</refentry>
|
|
||||||
@@ -1,15 +1,5 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
<refentry>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-instantiate">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-instantiate</refentrytitle>
|
|
||||||
<manvolnum>1</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
<refnamediv>
|
||||||
<refname>nix-instantiate</refname>
|
<refname>nix-instantiate</refname>
|
||||||
<refpurpose>instantiate store derivations from Nix expressions</refpurpose>
|
<refpurpose>instantiate store derivations from Nix expressions</refpurpose>
|
||||||
@@ -18,27 +8,13 @@
|
|||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>nix-instantiate</command>
|
<command>nix-instantiate</command>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(/db:nop/*)" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
|
||||||
<arg><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
|
|
||||||
<arg>
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='plain'><option>--attr</option></arg>
|
|
||||||
<arg choice='plain'><option>-A</option></arg>
|
|
||||||
</group>
|
|
||||||
<replaceable>attrPath</replaceable>
|
|
||||||
</arg>
|
|
||||||
<arg><option>--add-root</option> <replaceable>path</replaceable></arg>
|
<arg><option>--add-root</option> <replaceable>path</replaceable></arg>
|
||||||
<arg><option>--indirect</option></arg>
|
<arg><option>--indirect</option></arg>
|
||||||
<arg>
|
<group choice='opt'>
|
||||||
<group choice='req'>
|
<arg choice='plain'><option>--parse-only</option></arg>
|
||||||
<arg choice='plain'><option>--parse-only</option></arg>
|
<arg choice='plain'><option>--eval-only</option></arg>
|
||||||
<arg choice='plain'>
|
</group>
|
||||||
<option>--eval-only</option>
|
|
||||||
<arg><option>--strict</option></arg>
|
|
||||||
</arg>
|
|
||||||
</group>
|
|
||||||
<arg><option>--xml</option></arg>
|
|
||||||
</arg>
|
|
||||||
<arg choice='plain' rep='repeat'><replaceable>files</replaceable></arg>
|
<arg choice='plain' rep='repeat'><replaceable>files</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
@@ -54,10 +30,6 @@ evaluate to a derivation, a list of derivations, or a set of
|
|||||||
derivations. The paths of the resulting store derivations are printed
|
derivations. The paths of the resulting store derivations are printed
|
||||||
on standard output.</para>
|
on standard output.</para>
|
||||||
|
|
||||||
<para>If <replaceable>files</replaceable> is the character
|
|
||||||
<literal>-</literal>, then a Nix expression will be read from standard
|
|
||||||
input.</para>
|
|
||||||
|
|
||||||
<para>Most users and developers don’t need to use this command
|
<para>Most users and developers don’t need to use this command
|
||||||
(<command>nix-env</command> and <command>nix-build</command> perform
|
(<command>nix-env</command> and <command>nix-build</command> perform
|
||||||
store derivation instantiation from Nix expressions automatically).
|
store derivation instantiation from Nix expressions automatically).
|
||||||
@@ -100,31 +72,6 @@ common options.</para>
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--xml</option></term>
|
|
||||||
|
|
||||||
<listitem><para>When used with <option>--parse-only</option> and
|
|
||||||
<option>--eval-only</option>, print the resulting expression as an
|
|
||||||
XML representation of the abstract syntax tree rather than as an
|
|
||||||
ATerm. The schema is the same as that used by the <link
|
|
||||||
linkend="builtin-toXML"><function>toXML</function>
|
|
||||||
built-in</link>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--strict</option></term>
|
|
||||||
|
|
||||||
<listitem><para>When used with <option>--eval-only</option>,
|
|
||||||
recursively evaluate list elements and attributes. Normally, such
|
|
||||||
sub-expressions are left unevaluated (since the Nix expression
|
|
||||||
language is lazy).</para>
|
|
||||||
|
|
||||||
<warning><para>This option can cause non-termination, because lazy
|
|
||||||
data structures can be infinitely large.</para></warning>
|
|
||||||
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
@@ -132,9 +79,6 @@ common options.</para>
|
|||||||
|
|
||||||
<refsection><title>Examples</title>
|
<refsection><title>Examples</title>
|
||||||
|
|
||||||
<para>Instantiating store derivations from a Nix expression, and
|
|
||||||
building them using <command>nix-store</command>:
|
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-instantiate test.nix <lineannotation>(instantiate)</lineannotation>
|
$ nix-instantiate test.nix <lineannotation>(instantiate)</lineannotation>
|
||||||
/nix/store/cigxbmvy6dzix98dxxh9b6shg7ar5bvs-perl-BerkeleyDB-0.26.drv
|
/nix/store/cigxbmvy6dzix98dxxh9b6shg7ar5bvs-perl-BerkeleyDB-0.26.drv
|
||||||
@@ -147,54 +91,6 @@ $ ls -l /nix/store/qhqk4n8ci095g3sdp93x7rgwyh9rdvgk-perl-BerkeleyDB-0.26
|
|||||||
dr-xr-xr-x 2 eelco users 4096 1970-01-01 01:00 lib
|
dr-xr-xr-x 2 eelco users 4096 1970-01-01 01:00 lib
|
||||||
...</screen>
|
...</screen>
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>Parsing and evaluating Nix expressions:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ echo '"foo" + "bar"' | nix-instantiate --parse-only -
|
|
||||||
OpPlus(Str("foo"),Str("bar"))
|
|
||||||
|
|
||||||
$ echo '"foo" + "bar"' | nix-instantiate --eval-only -
|
|
||||||
Str("foobar")
|
|
||||||
|
|
||||||
$ echo '"foo" + "bar"' | nix-instantiate --eval-only --xml -
|
|
||||||
<![CDATA[<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<expr>
|
|
||||||
<string value="foobar" />
|
|
||||||
</expr>]]></screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>The difference between non-strict and strict evaluation:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ echo 'rec { x = "foo"; y = x; }' | nix-instantiate --eval-only --xml -
|
|
||||||
<replaceable>...</replaceable><![CDATA[
|
|
||||||
<attr name="x">
|
|
||||||
<string value="foo" />
|
|
||||||
</attr>
|
|
||||||
<attr name="y">
|
|
||||||
<unevaluated />
|
|
||||||
</attr>]]>
|
|
||||||
<replaceable>...</replaceable></screen>
|
|
||||||
|
|
||||||
Note that <varname>y</varname> is left unevaluated (the XML
|
|
||||||
representation doesn’t attempt to show non-normal forms).
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ echo 'rec { x = "foo"; y = x; }' | nix-instantiate --eval-only --xml --strict -
|
|
||||||
<replaceable>...</replaceable><![CDATA[
|
|
||||||
<attr name="x">
|
|
||||||
<string value="foo" />
|
|
||||||
</attr>
|
|
||||||
<attr name="y">
|
|
||||||
<string value="foo" />
|
|
||||||
</attr>]]>
|
|
||||||
<replaceable>...</replaceable></screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -178,5 +178,100 @@
|
|||||||
</productionset>
|
</productionset>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<sect1>
|
||||||
|
<title>Semantics</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<sect2>
|
||||||
|
<title>Built-in functions</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The Nix language provides the following built-in function
|
||||||
|
(<quote>primops</quote>):
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><function>import</function>
|
||||||
|
<replaceable>e</replaceable></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Evaluates the expression <replaceable>e</replaceable>,
|
||||||
|
which must yield a path value. The Nix expression
|
||||||
|
stored at this path in the file system is then read,
|
||||||
|
parsed, and evaluated. Returns the result of the
|
||||||
|
evaluation of the Nix expression just read.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Example: <literal>import ./foo.nix</literal> evaluates
|
||||||
|
the expression stored in <filename>foo.nix</filename>
|
||||||
|
(in the directory containing the expression in which the
|
||||||
|
<function>import</function> occurs).
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><function>derivation</function>
|
||||||
|
<replaceable>e</replaceable></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Evaluates the expression <replaceable>e</replaceable>,
|
||||||
|
which must yield an attribute set. [...]
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><function>baseNameOf</function>
|
||||||
|
<replaceable>e</replaceable></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Evaluates the expression <replaceable>e</replaceable>,
|
||||||
|
which must yield a string value, and returns a string
|
||||||
|
representing its <emphasis>base name</emphasis>. This
|
||||||
|
is the substring following the last path separator
|
||||||
|
(<literal>/</literal>).
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Example: <literal>baseNameOf "/foo/bar"</literal>
|
||||||
|
returns <literal>"bar"</literal>, and
|
||||||
|
<literal>baseNameOf "/foo/bar/"</literal> returns
|
||||||
|
<literal>""</literal>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><function>toString</function>
|
||||||
|
<replaceable>e</replaceable></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Evaluates the expression <replaceable>e</replaceable>
|
||||||
|
and coerces it into a string, if possible. Only
|
||||||
|
strings, paths, and URIs can be so coerced.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Example: <literal>toString
|
||||||
|
http://www.cs.uu.nl/</literal> returns
|
||||||
|
<literal>"http://www.cs.uu.nl/"</literal>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
</variablelist>
|
||||||
|
|
||||||
|
</sect2>
|
||||||
|
|
||||||
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
</appendix>
|
</appendix>
|
||||||
@@ -1,15 +1,5 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
<refentry>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-prefetch-url">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-prefetch-url</refentrytitle>
|
|
||||||
<manvolnum>1</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
<refnamediv>
|
||||||
<refname>nix-prefetch-url</refname>
|
<refname>nix-prefetch-url</refname>
|
||||||
<refpurpose>copy a file from a URL into the store and print its MD5 hash</refpurpose>
|
<refpurpose>copy a file from a URL into the store and print its MD5 hash</refpurpose>
|
||||||
@@ -48,7 +38,7 @@ avoided.</para>
|
|||||||
<para>The environment variable <envar>NIX_HASH_ALGO</envar> specifies
|
<para>The environment variable <envar>NIX_HASH_ALGO</envar> specifies
|
||||||
which hash algorithm to use. It can be either <literal>md5</literal>,
|
which hash algorithm to use. It can be either <literal>md5</literal>,
|
||||||
<literal>sha1</literal>, or <literal>sha256</literal>. The default is
|
<literal>sha1</literal>, or <literal>sha256</literal>. The default is
|
||||||
<literal>sha256</literal>.</para>
|
<literal>md5</literal>.</para>
|
||||||
|
|
||||||
<para>If <replaceable>hash</replaceable> is specified, then a download
|
<para>If <replaceable>hash</replaceable> is specified, then a download
|
||||||
is not performed if the Nix store already contains a file with the
|
is not performed if the Nix store already contains a file with the
|
||||||
|
|||||||
+34
-41
@@ -1,50 +1,43 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
<refentry>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
<refnamediv>
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
<refname>nix-pull</refname>
|
||||||
xml:id="sec-nix-pull">
|
<refpurpose>pull substitutes from a network cache</refpurpose>
|
||||||
|
</refnamediv>
|
||||||
|
|
||||||
<refmeta>
|
<refsynopsisdiv>
|
||||||
<refentrytitle>nix-pull</refentrytitle>
|
<cmdsynopsis>
|
||||||
<manvolnum>1</manvolnum>
|
<command>nix-pull</command>
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
<arg choice='plain'><replaceable>url</replaceable></arg>
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
</cmdsynopsis>
|
||||||
</refmeta>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
<refnamediv>
|
<refsection>
|
||||||
<refname>nix-pull</refname>
|
<title>Description</title>
|
||||||
<refpurpose>pull substitutes from a network cache</refpurpose>
|
|
||||||
</refnamediv>
|
|
||||||
|
|
||||||
<refsynopsisdiv>
|
<para>
|
||||||
<cmdsynopsis>
|
The command <command>nix-pull</command> obtains a list of
|
||||||
<command>nix-pull</command>
|
pre-built store paths from the URL
|
||||||
<arg choice='plain'><replaceable>url</replaceable></arg>
|
<replaceable>url</replaceable>, and for each of these store
|
||||||
</cmdsynopsis>
|
paths, registers a substitute derivation that downloads and
|
||||||
</refsynopsisdiv>
|
unpacks it into the Nix store. This is used to speed up
|
||||||
|
installations: if you attempt to install something that has
|
||||||
|
already been built and stored into the network cache, Nix can
|
||||||
|
transparently re-use the pre-built store paths.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The file at <replaceable>url</replaceable> must be compatible
|
||||||
|
with the files created by <replaceable>nix-push</replaceable>.
|
||||||
|
</para>
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
</refsection>
|
||||||
|
|
||||||
<para>The command <command>nix-pull</command> obtains a list of
|
<refsection>
|
||||||
pre-built store paths from the URL <replaceable>url</replaceable>, and
|
<title>Examples</title>
|
||||||
for each of these store paths, registers a substitute derivation that
|
|
||||||
downloads and unpacks it into the Nix store. This is used to speed up
|
|
||||||
installations: if you attempt to install something that has already
|
|
||||||
been built and stored into the network cache, Nix can transparently
|
|
||||||
re-use the pre-built store paths.</para>
|
|
||||||
|
|
||||||
<para>The file at <replaceable>url</replaceable> must be compatible
|
|
||||||
with the files created by <replaceable>nix-push</replaceable>.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Examples</title>
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-pull http://nix.cs.uu.nl/dist/nix/nixpkgs-0.5pre753/MANIFEST</screen>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
<screen>
|
||||||
|
$ nix-pull http://catamaran.labs.cs.uu.nl/dist/nix/nixpkgs-0.5pre753/MANIFEST</screen>
|
||||||
|
|
||||||
|
</refsection>
|
||||||
|
|
||||||
</refentry>
|
</refentry>
|
||||||
+6
-19
@@ -1,14 +1,4 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
<refentry>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-push">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-push</refentrytitle>
|
|
||||||
<manvolnum>1</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
<refnamediv>
|
||||||
<refname>nix-push</refname>
|
<refname>nix-push</refname>
|
||||||
@@ -72,15 +62,14 @@ machines using the <command>nix-pull</command> command.</para>
|
|||||||
specified by <replaceable>archivesPutURL</replaceable>. HTTP PUT
|
specified by <replaceable>archivesPutURL</replaceable>. HTTP PUT
|
||||||
requests are used to do this. However, before a file
|
requests are used to do this. However, before a file
|
||||||
<varname>x</varname> is uploaded to
|
<varname>x</varname> is uploaded to
|
||||||
<literal><replaceable>archivesPutURL</replaceable>/</literal><varname>x</varname>,
|
<literal><replaceable>archivesPutURL</replaceable>/<varname>x</varname></literal>,
|
||||||
<command>nix-push</command> first determines whether this upload is
|
<command>nix-push</command> first determines whether this upload is
|
||||||
unnecessary by issuing a HTTP HEAD request on
|
unnecessary by issuing a HTTP HEAD request on
|
||||||
<literal><replaceable>archivesGetURL</replaceable>/</literal><varname>x</varname>.
|
<literal><replaceable>archivesGetURL</replaceable>/<varname>x</varname></literal>.
|
||||||
This allows a cache to be shared between many partially overlapping
|
This allows a cache to be shared between many partially overlapping
|
||||||
<command>nix-push</command> invocations. (We use two URLs because
|
<command>nix-push</command> invocations. (We use two URLs because
|
||||||
the upload URL typically refers to a CGI script, while the download
|
the upload URL typically refers to a CGI script, while the download
|
||||||
URL just refers to a file system directory on the
|
URL just refers to a file system directory on the server.)</para></listitem>
|
||||||
server.)</para></listitem>
|
|
||||||
|
|
||||||
<listitem><para>The manifest is uploaded using an HTTP PUT request
|
<listitem><para>The manifest is uploaded using an HTTP PUT request
|
||||||
to <replaceable>manifestPutURL</replaceable>. The corresponding
|
to <replaceable>manifestPutURL</replaceable>. The corresponding
|
||||||
@@ -91,9 +80,7 @@ machines using the <command>nix-pull</command> command.</para>
|
|||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<!--
|
<para>TODO: <option>--copy</option></para>
|
||||||
<para>TODO: <option>- -copy</option></para>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
@@ -120,7 +107,7 @@ dependencies used in the build, such as compilers).</para>
|
|||||||
dependencies, we can do:
|
dependencies, we can do:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-push <replaceable>urls</replaceable> $(nix-store -r $(nix-instantiate foo.nix))</screen>
|
$ nix-push <replaceable>urls</replaceable> $(nix-instantiate $(nix-store -r foo.nix))</screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|||||||
+63
-464
@@ -1,14 +1,4 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
<refentry>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-store">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-store</refentrytitle>
|
|
||||||
<manvolnum>1</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
<refnamediv>
|
||||||
<refname>nix-store</refname>
|
<refname>nix-store</refname>
|
||||||
@@ -18,7 +8,7 @@
|
|||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>nix-store</command>
|
<command>nix-store</command>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xmlns(db=http://docbook.org/ns/docbook)xpointer(/db:nop/*)" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
|
||||||
<arg><option>--add-root</option> <replaceable>path</replaceable></arg>
|
<arg><option>--add-root</option> <replaceable>path</replaceable></arg>
|
||||||
<arg><option>--indirect</option></arg>
|
<arg><option>--indirect</option></arg>
|
||||||
<arg choice='plain'><replaceable>operation</replaceable></arg>
|
<arg choice='plain'><replaceable>operation</replaceable></arg>
|
||||||
@@ -53,7 +43,7 @@ linkend="sec-common-options" /> for a list of common options.</para>
|
|||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry xml:id="opt-add-root"><term><option>--add-root</option> <replaceable>path</replaceable></term>
|
<varlistentry id="opt-add-root"><term><option>--add-root</option> <replaceable>path</replaceable></term>
|
||||||
|
|
||||||
<listitem><para>Causes the result of a realisation
|
<listitem><para>Causes the result of a realisation
|
||||||
(<option>--realise</option> and <option>--force-realise</option>)
|
(<option>--realise</option> and <option>--force-realise</option>)
|
||||||
@@ -118,7 +108,8 @@ lrwxrwxrwx 1 ... 2005-03-13 21:10 /home/eelco/bla/result -> /nix/store/1r1134
|
|||||||
|
|
||||||
<!--######################################################################-->
|
<!--######################################################################-->
|
||||||
|
|
||||||
<refsection xml:id='rsec-nix-store-realise'><title>Operation <option>--realise</option></title>
|
<refsection id='rsec-nix-store-realise'><title>Operation
|
||||||
|
<option>--realise</option></title>
|
||||||
|
|
||||||
<refsection><title>Synopsis</title>
|
<refsection><title>Synopsis</title>
|
||||||
|
|
||||||
@@ -129,7 +120,6 @@ lrwxrwxrwx 1 ... 2005-03-13 21:10 /home/eelco/bla/result -> /nix/store/1r1134
|
|||||||
<arg choice='plain'><option>-r</option></arg>
|
<arg choice='plain'><option>-r</option></arg>
|
||||||
</group>
|
</group>
|
||||||
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
|
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
|
||||||
<arg><option>--dry-run</option></arg>
|
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
@@ -168,11 +158,6 @@ the specified store paths. Realisation is a somewhat overloaded term:
|
|||||||
output. (For non-derivations argument, the argument itself is
|
output. (For non-derivations argument, the argument itself is
|
||||||
printed.)</para>
|
printed.)</para>
|
||||||
|
|
||||||
<para>If the <option>--dry-run</option> option is used, then
|
|
||||||
<command>nix-store</command> will print on standard error a
|
|
||||||
description of what packages would be built or downloaded, and then
|
|
||||||
quit.</para>
|
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
@@ -198,7 +183,7 @@ linkend="sec-nix-build"><command>nix-build</command></link> does.</para>
|
|||||||
|
|
||||||
<!--######################################################################-->
|
<!--######################################################################-->
|
||||||
|
|
||||||
<refsection xml:id='rsec-nix-store-gc'><title>Operation <option>--gc</option></title>
|
<refsection id='rsec-nix-store-gc'><title>Operation <option>--gc</option></title>
|
||||||
|
|
||||||
<refsection><title>Synopsis</title>
|
<refsection><title>Synopsis</title>
|
||||||
|
|
||||||
@@ -211,8 +196,6 @@ linkend="sec-nix-build"><command>nix-build</command></link> does.</para>
|
|||||||
<arg choice='plain'><option>--print-dead</option></arg>
|
<arg choice='plain'><option>--print-dead</option></arg>
|
||||||
<arg choice='plain'><option>--delete</option></arg>
|
<arg choice='plain'><option>--delete</option></arg>
|
||||||
</group>
|
</group>
|
||||||
<arg><option>--max-freed</option> <replaceable>bytes</replaceable></arg>
|
|
||||||
<arg><option>--max-links</option> <replaceable>nrlinks</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
@@ -267,44 +250,12 @@ the Nix store not reachable via file system references from a set of
|
|||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
<para>By default, all unreachable paths are deleted. The following
|
<para>The behaviour of the collector is influenced by the <link
|
||||||
options control what gets deleted and in what order:
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--max-freed</option> <replaceable>bytes</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Keep deleting paths until at least
|
|
||||||
<replaceable>bytes</replaceable> bytes have been
|
|
||||||
deleted, then stop.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--max-links</option> <replaceable>nrlinks</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>Keep deleting paths until the hard link count on
|
|
||||||
<filename>/nix/store</filename> is less than
|
|
||||||
<replaceable>nrlinks</replaceable>, then stop. This is useful for
|
|
||||||
very large Nix stores on filesystems with a 32000 subdirectories
|
|
||||||
limit (like <literal>ext3</literal>).</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>The behaviour of the collector is also influenced by the <link
|
|
||||||
linkend="conf-gc-keep-outputs"><literal>gc-keep-outputs</literal></link>
|
linkend="conf-gc-keep-outputs"><literal>gc-keep-outputs</literal></link>
|
||||||
and <link
|
and <link
|
||||||
linkend="conf-gc-keep-derivations"><literal>gc-keep-derivations</literal></link>
|
linkend="conf-gc-keep-derivations"><literal>gc-keep-derivations</literal></link>
|
||||||
variables in the Nix configuration file.</para>
|
variables in the Nix configuration file.</para>
|
||||||
|
|
||||||
<para>With <option>--delete</option>, the collector prints the total
|
|
||||||
number of freed bytes when it finishes (or when it is interrupted).
|
|
||||||
With <option>--print-dead</option>, it prints the number of bytes that
|
|
||||||
would be freed.</para>
|
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
@@ -313,17 +264,7 @@ would be freed.</para>
|
|||||||
<para>To delete all unreachable paths, just do:
|
<para>To delete all unreachable paths, just do:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-store --gc
|
$ nix-store --gc</screen>
|
||||||
deleting `/nix/store/kq82idx6g0nyzsp2s14gfsc38npai7lf-cairo-1.0.4.tar.gz.drv'
|
|
||||||
<replaceable>...</replaceable>
|
|
||||||
8825586 bytes freed (8.42 MiB)</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>To delete at least 100 MiBs of unreachable paths:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-store --gc --max-freed $((100 * 1024 * 1024))</screen>
|
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@@ -336,52 +277,7 @@ $ nix-store --gc --max-freed $((100 * 1024 * 1024))</screen>
|
|||||||
|
|
||||||
<!--######################################################################-->
|
<!--######################################################################-->
|
||||||
|
|
||||||
<refsection><title>Operation <option>--delete</option></title>
|
<refsection><title>Operation <option>--query</option></title>
|
||||||
|
|
||||||
<refsection><title>Synopsis</title>
|
|
||||||
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-store</command>
|
|
||||||
<arg choice='plain'><option>--delete</option></arg>
|
|
||||||
<arg><option>--ignore-liveness</option></arg>
|
|
||||||
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The operation <option>--delete</option> deletes the store paths
|
|
||||||
<replaceable>paths</replaceable> from the Nix store, but only if it is
|
|
||||||
safe to do so; that is, when the path is not reachable from a root of
|
|
||||||
the garbage collector. This means that you can only delete paths that
|
|
||||||
would also be deleted by <literal>nix-store --gc</literal>. Thus,
|
|
||||||
<literal>--delete</literal> is a more targeted version of
|
|
||||||
<literal>--gc</literal>.</para>
|
|
||||||
|
|
||||||
<para>With the option <option>--ignore-liveness</option>, reachability
|
|
||||||
from the roots is ignored. However, the path still won’t be deleted
|
|
||||||
if there are other paths in the store that refer to it (i.e., depend
|
|
||||||
on it).</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Example</title>
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-store --delete /nix/store/zq0h41l75vlb4z45kzgjjmsjxvcv1qk7-mesa-6.4
|
|
||||||
0 bytes freed (0.00 MiB)
|
|
||||||
error: cannot delete path `/nix/store/zq0h41l75vlb4z45kzgjjmsjxvcv1qk7-mesa-6.4' since it is still alive</screen>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--######################################################################-->
|
|
||||||
|
|
||||||
<refsection xml:id='refsec-nix-store-query'><title>Operation <option>--query</option></title>
|
|
||||||
|
|
||||||
<refsection><title>Synopsis</title>
|
<refsection><title>Synopsis</title>
|
||||||
|
|
||||||
@@ -396,16 +292,14 @@ error: cannot delete path `/nix/store/zq0h41l75vlb4z45kzgjjmsjxvcv1qk7-mesa-6.4'
|
|||||||
<arg choice='plain'><option>--requisites</option></arg>
|
<arg choice='plain'><option>--requisites</option></arg>
|
||||||
<arg choice='plain'><option>-R</option></arg>
|
<arg choice='plain'><option>-R</option></arg>
|
||||||
<arg choice='plain'><option>--references</option></arg>
|
<arg choice='plain'><option>--references</option></arg>
|
||||||
<arg choice='plain'><option>--referrers</option></arg>
|
<arg choice='plain'><option>--referers</option></arg>
|
||||||
<arg choice='plain'><option>--referrers-closure</option></arg>
|
<arg choice='plain'><option>--referers-closure</option></arg>
|
||||||
<arg choice='plain'><option>--deriver</option></arg>
|
<arg choice='plain'><option>--deriver</option></arg>
|
||||||
<arg choice='plain'><option>--deriver</option></arg>
|
<arg choice='plain'><option>--deriver</option></arg>
|
||||||
<arg choice='plain'><option>--graph</option></arg>
|
<arg choice='plain'><option>--graph</option></arg>
|
||||||
<arg choice='plain'><option>--tree</option></arg>
|
<arg choice='plain'><option>--tree</option></arg>
|
||||||
<arg choice='plain'><option>--binding</option> <replaceable>name</replaceable></arg>
|
<arg choice='plain'><option>--binding</option> <replaceable>name</replaceable></arg>
|
||||||
<arg choice='plain'><option>--hash</option></arg>
|
<arg choice='plain'><option>--hash</option></arg>
|
||||||
<arg choice='plain'><option>--size</option></arg>
|
|
||||||
<arg choice='plain'><option>--roots</option></arg>
|
|
||||||
</group>
|
</group>
|
||||||
<arg><option>--use-output</option></arg>
|
<arg><option>--use-output</option></arg>
|
||||||
<arg><option>-u</option></arg>
|
<arg><option>-u</option></arg>
|
||||||
@@ -459,7 +353,7 @@ query is applied to the target of the symlink.</para>
|
|||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
<refsection xml:id='nixref-queries'><title>Queries</title>
|
<refsection id='nixref-queries'><title>Queries</title>
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
@@ -517,21 +411,21 @@ query is applied to the target of the symlink.</para>
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--referrers</option></term>
|
<varlistentry><term><option>--referers</option></term>
|
||||||
|
|
||||||
<listitem><para>Prints the set of <emphasis>referrers</emphasis> of
|
<listitem><para>Prints the set of <emphasis>referers</emphasis> of
|
||||||
the store paths <replaceable>paths</replaceable>, that is, the
|
the store paths <replaceable>paths</replaceable>, that is, the
|
||||||
store paths currently existing in the Nix store that refer to one
|
store paths currently existing in the Nix store that refer to one
|
||||||
of <replaceable>paths</replaceable>. Note that contrary to the
|
of <replaceable>paths</replaceable>. Note that contrary to the
|
||||||
references, the set of referrers is not constant; it can change as
|
references, the set of referers is not constant; it can change as
|
||||||
store paths are added or removed.</para></listitem>
|
store paths are added or removed.</para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--referrers-closure</option></term>
|
<varlistentry><term><option>--referers-closure</option></term>
|
||||||
|
|
||||||
<listitem><para>Prints the closure of the set of store paths
|
<listitem><para>Prints the closure of the set of store paths
|
||||||
<replaceable>paths</replaceable> under the referrers relation; that
|
<replaceable>paths</replaceable> under the referers relation; that
|
||||||
is, all store paths that directly or indirectly refer to one of
|
is, all store paths that directly or indirectly refer to one of
|
||||||
<replaceable>paths</replaceable>. These are all the path currently
|
<replaceable>paths</replaceable>. These are all the path currently
|
||||||
in the Nix store that are dependent on
|
in the Nix store that are dependent on
|
||||||
@@ -554,11 +448,11 @@ query is applied to the target of the symlink.</para>
|
|||||||
|
|
||||||
<listitem><para>Prints the references graph of the store paths
|
<listitem><para>Prints the references graph of the store paths
|
||||||
<replaceable>paths</replaceable> in the format of the
|
<replaceable>paths</replaceable> in the format of the
|
||||||
<command>dot</command> tool of AT&T's <link
|
<command>dot</command> tool of AT&T's <ulink
|
||||||
xlink:href="http://www.graphviz.org/">Graphviz package</link>.
|
url="http://www.graphviz.org/">Graphviz package</ulink>. This can
|
||||||
This can be used to visualise dependency graphs. To obtain a
|
be used to visualise dependency graphs. To obtain a build-time
|
||||||
build-time dependency graph, apply this to a store derivation. To
|
dependency graph, apply this to a store derivation. To obtain a
|
||||||
obtain a runtime dependency graph, apply it to an output
|
runtime dependency graph, apply it to an output
|
||||||
path.</para></listitem>
|
path.</para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -588,29 +482,9 @@ query is applied to the target of the symlink.</para>
|
|||||||
<varlistentry><term><option>--hash</option></term>
|
<varlistentry><term><option>--hash</option></term>
|
||||||
|
|
||||||
<listitem><para>Prints the SHA-256 hash of the contents of the
|
<listitem><para>Prints the SHA-256 hash of the contents of the
|
||||||
store paths <replaceable>paths</replaceable> (that is, the hash of
|
store path <replaceable>paths</replaceable>. Since the hash is
|
||||||
the output of <command>nix-store --dump</command> on the given
|
stored in the Nix database, this is a fast
|
||||||
paths). Since the hash is stored in the Nix database, this is a
|
operation.</para></listitem>
|
||||||
fast operation.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--size</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Prints the size in bytes of the contents of the
|
|
||||||
store paths <replaceable>paths</replaceable> — to be precise, the
|
|
||||||
size of the output of <command>nix-store --dump</command> on the
|
|
||||||
given paths. Note that the actual disk space required by the
|
|
||||||
store paths may be higher, especially on filesystems with large
|
|
||||||
cluster sizes.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--roots</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Prints the garbage collector roots that point,
|
|
||||||
directly or indirectly, at the store paths
|
|
||||||
<replaceable>paths</replaceable>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -626,8 +500,8 @@ query is applied to the target of the symlink.</para>
|
|||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-store -qR $(which svn)
|
$ nix-store -qR $(which svn)
|
||||||
/nix/store/5mbglq5ldqld8sj57273aljwkfvj22mc-subversion-1.1.4
|
/nix/store/4mbglq5ldqld8sj57273aljwkfvj22mc-subversion-1.1.4
|
||||||
/nix/store/9lz9yc6zgmc0vlqmn2ipcpkjlmbi51vv-glibc-2.3.4
|
/nix/store/8lz9yc6zgmc0vlqmn2ipcpkjlmbi51vv-glibc-2.3.4
|
||||||
<replaceable>...</replaceable></screen>
|
<replaceable>...</replaceable></screen>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
@@ -662,9 +536,9 @@ $ nix-store -q --tree $(nix-store -qd $(which svn))
|
|||||||
<command>svn</command>:
|
<command>svn</command>:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-store -q --referrers $(nix-store -q --binding openssl $(nix-store -qd $(which svn)))
|
$ nix-store -q --referers $(nix-store -q --binding openssl $(nix-store -qd $(which svn)))
|
||||||
/nix/store/23ny9l9wixx21632y2wi4p585qhva1q8-sylpheed-1.0.0
|
/nix/store/23ny9l9wixx21632y2wi4p585qhva1q8-sylpheed-1.0.0
|
||||||
/nix/store/5mbglq5ldqld8sj57273aljwkfvj22mc-subversion-1.1.4
|
/nix/store/4mbglq5ldqld8sj57273aljwkfvj22mc-subversion-1.1.4
|
||||||
/nix/store/dpmvp969yhdqs7lm2r1a3gng7pyq6vy4-subversion-1.1.3
|
/nix/store/dpmvp969yhdqs7lm2r1a3gng7pyq6vy4-subversion-1.1.3
|
||||||
/nix/store/l51240xqsgg8a7yrbqdx1rfzyv6l26fx-lynx-2.8.5</screen>
|
/nix/store/l51240xqsgg8a7yrbqdx1rfzyv6l26fx-lynx-2.8.5</screen>
|
||||||
|
|
||||||
@@ -674,9 +548,9 @@ $ nix-store -q --referrers $(nix-store -q --binding openssl $(nix-store -qd $(wh
|
|||||||
(C library) used by <command>svn</command>:
|
(C library) used by <command>svn</command>:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-store -q --referrers-closure $(ldd $(which svn) | grep /libc.so | awk '{print $3}')
|
$ nix-store -q --referers-closure $(ldd $(which svn) | grep /libc.so | awk '{print $3}')
|
||||||
/nix/store/034a6h4vpz9kds5r6kzb9lhh81mscw43-libgnomeprintui-2.8.2
|
/nix/store/034a6h4vpz9kds5r6kzb9lhh81mscw43-libgnomeprintui-2.8.2
|
||||||
/nix/store/15l3yi0d45prm7a82pcrknxdh6nzmxza-gawk-3.1.4
|
/nix/store/05l3yi0d45prm7a82pcrknxdh6nzmxza-gawk-3.1.4
|
||||||
<replaceable>...</replaceable></screen>
|
<replaceable>...</replaceable></screen>
|
||||||
|
|
||||||
Note that <command>ldd</command> is a command that prints out the
|
Note that <command>ldd</command> is a command that prints out the
|
||||||
@@ -691,18 +565,6 @@ $ gv graph.ps</screen>
|
|||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>Show every garbage collector root that points to a store path
|
|
||||||
that depends on <command>svn</command>:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-store -q --roots $(which svn)
|
|
||||||
/nix/var/nix/profiles/default-81-link
|
|
||||||
/nix/var/nix/profiles/default-82-link
|
|
||||||
/nix/var/nix/profiles/per-user/eelco/profile-97-link
|
|
||||||
</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
@@ -713,7 +575,7 @@ $ nix-store -q --roots $(which svn)
|
|||||||
<!--######################################################################-->
|
<!--######################################################################-->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<refsection xml:id="rsec-nix-store-reg-val"><title>Operation <option>-XXX-register-validity</option></title>
|
<refsection id="rsec-nix-store-reg-val"><title>Operation <option>-XXX-register-validity</option></title>
|
||||||
|
|
||||||
<refsection><title>Synopsis</title>
|
<refsection><title>Synopsis</title>
|
||||||
|
|
||||||
@@ -736,7 +598,37 @@ $ nix-store -q --roots $(which svn)
|
|||||||
|
|
||||||
<!--######################################################################-->
|
<!--######################################################################-->
|
||||||
|
|
||||||
<refsection xml:id='refsec-nix-store-verify'><title>Operation <option>--verify</option></title>
|
<!--
|
||||||
|
<refsection><title>Operation <option>-XXX-substitute</option></title>
|
||||||
|
|
||||||
|
<refsection><title>Synopsis</title>
|
||||||
|
|
||||||
|
<cmdsynopsis>
|
||||||
|
<command>nix-store</command>
|
||||||
|
<arg choice='plain'><option>-XXX-substitute</option></arg>
|
||||||
|
<arg choice='plain'
|
||||||
|
rep='repeat'><replaceable>srcpath</replaceable> <replaceable>subpath</replaceable></arg>
|
||||||
|
</cmdsynopsis>
|
||||||
|
</refsection>
|
||||||
|
|
||||||
|
<refsection><title>Description</title>
|
||||||
|
|
||||||
|
<para>The operation <option>-XXX-substitute</option> registers that the
|
||||||
|
store path <replaceable>srcpath</replaceable> can be built by
|
||||||
|
realising the derivation expression in
|
||||||
|
<replaceable>subpath</replaceable>. This is used to implement binary
|
||||||
|
deployment.</para>
|
||||||
|
|
||||||
|
</refsection>
|
||||||
|
|
||||||
|
</refsection>
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--######################################################################-->
|
||||||
|
|
||||||
|
<refsection><title>Operation <option>--verify</option></title>
|
||||||
|
|
||||||
<refsection>
|
<refsection>
|
||||||
<title>Synopsis</title>
|
<title>Synopsis</title>
|
||||||
@@ -777,301 +669,8 @@ in Nix itself.</para>
|
|||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
|
|
||||||
<!--######################################################################-->
|
|
||||||
|
|
||||||
<refsection xml:id='refsec-nix-store-dump'><title>Operation <option>--dump</option></title>
|
|
||||||
|
|
||||||
<refsection>
|
|
||||||
<title>Synopsis</title>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-store</command>
|
|
||||||
<arg choice='plain'><option>--dump</option></arg>
|
|
||||||
<arg choice='plain'><replaceable>path</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The operation <option>--dump</option> produces a NAR (Nix
|
|
||||||
ARchive) file containing the contents of the file system tree rooted
|
|
||||||
at <replaceable>path</replaceable>. The archive is written to
|
|
||||||
standard output.</para>
|
|
||||||
|
|
||||||
<para>A NAR archive is like a TAR or Zip archive, but it contains only
|
|
||||||
the information that Nix considers important. For instance,
|
|
||||||
timestamps are elided because all files in the Nix store have their
|
|
||||||
timestamp set to 0 anyway. Likewise, all permissions are left out
|
|
||||||
except for the execute bit, because all files in the Nix store have
|
|
||||||
644 or 755 permission.</para>
|
|
||||||
|
|
||||||
<para>Also, a NAR archive is <emphasis>canonical</emphasis>, meaning
|
|
||||||
that “equal” paths always produce the same NAR archive. For instance,
|
|
||||||
directory entries are always sorted so that the actual on-disk order
|
|
||||||
doesn’t influence the result. This means that the cryptographic hash
|
|
||||||
of a NAR dump of a path is usable as a fingerprint of the contents of
|
|
||||||
the path. Indeed, the hashes of store paths stored in Nix’s database
|
|
||||||
(see <link linkend="refsec-nix-store-query"><literal>nix-store -q
|
|
||||||
--hash</literal></link>) are SHA-256 hashes of the NAR dump of each
|
|
||||||
store path.</para>
|
|
||||||
|
|
||||||
<para>NAR archives support filenames of unlimited length and 64-bit
|
|
||||||
file sizes. They can contain regular files, directories, and symbolic
|
|
||||||
links, but not other types of files (such as device nodes).</para>
|
|
||||||
|
|
||||||
<para>A Nix archive can be unpacked using <literal>nix-store
|
|
||||||
--restore</literal>.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<!--######################################################################-->
|
|
||||||
|
|
||||||
<refsection><title>Operation <option>--restore</option></title>
|
|
||||||
|
|
||||||
<refsection>
|
|
||||||
<title>Synopsis</title>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-store</command>
|
|
||||||
<arg choice='plain'><option>--restore</option></arg>
|
|
||||||
<arg choice='plain'><replaceable>path</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The operation <option>--restore</option> unpacks a NAR archive
|
|
||||||
to <replaceable>path</replaceable>, which must not already exist. The
|
|
||||||
archive is read from standard input.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<!--######################################################################-->
|
|
||||||
|
|
||||||
<refsection xml:id='refsec-nix-store-export'><title>Operation <option>--export</option></title>
|
|
||||||
|
|
||||||
<refsection>
|
|
||||||
<title>Synopsis</title>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-store</command>
|
|
||||||
<arg choice='plain'><option>--export</option></arg>
|
|
||||||
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The operation <option>--export</option> writes a serialisation
|
|
||||||
of the specified store paths to standard output in a format that can
|
|
||||||
be imported into another Nix store with <command
|
|
||||||
linkend="refsec-nix-store-import">nix-store --import</command>. This
|
|
||||||
is like <command linkend="refsec-nix-store-dump">nix-store
|
|
||||||
--dump</command>, except that the NAR archive produced by that command
|
|
||||||
doesn’t contain the necessary meta-information to allow it to be
|
|
||||||
imported into another Nix store (namely, the set of references of the
|
|
||||||
path).</para>
|
|
||||||
|
|
||||||
<para>This command does not produce a <emphasis>closure</emphasis> of
|
|
||||||
the specified paths, so if a store path references other store paths
|
|
||||||
that are missing in the target Nix store, the import will fail. To
|
|
||||||
copy a whole closure, do something like
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-store --export $(nix-store -qR <replaceable>paths</replaceable>) > out</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>For an example of how <option>--export</option> and
|
|
||||||
<option>--import</option> can be used, see the source of the <command
|
|
||||||
linkend="sec-nix-copy-closure">nix-copy-closure</command>
|
|
||||||
command.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<!--######################################################################-->
|
|
||||||
|
|
||||||
<refsection xml:id='refsec-nix-store-import'><title>Operation <option>--import</option></title>
|
|
||||||
|
|
||||||
<refsection>
|
|
||||||
<title>Synopsis</title>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-store</command>
|
|
||||||
<arg choice='plain'><option>--import</option></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The operation <option>--export</option> reads a serialisation of
|
|
||||||
a set of store paths produced by <command
|
|
||||||
linkend="refsec-nix-store-export">nix-store --import</command> from
|
|
||||||
standard input and adds those store paths to the Nix store. Paths
|
|
||||||
that already exist in the Nix store are ignored. If a path refers to
|
|
||||||
another path that doesn’t exist in the Nix store, the import
|
|
||||||
fails.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<!--######################################################################-->
|
|
||||||
|
|
||||||
<refsection><title>Operation <option>--optimise</option></title>
|
|
||||||
|
|
||||||
<refsection>
|
|
||||||
<title>Synopsis</title>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-store</command>
|
|
||||||
<arg choice='plain'><option>--optimise</option></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The operation <option>--optimise</option> reduces Nix store disk
|
|
||||||
space usage by finding identical files in the store and hard-linking
|
|
||||||
them to each other. It typically reduces the size of the store by
|
|
||||||
something like 25-35%. Only regular files and symlinks are
|
|
||||||
hard-linked in this manner. Files are considered identical when they
|
|
||||||
have the same NAR archive serialisation: that is, regular files must
|
|
||||||
have the same contents and permission (executable or non-executable),
|
|
||||||
and symlinks must have the same contents.</para>
|
|
||||||
|
|
||||||
<para>After completion, or when the command is interrupted, a report
|
|
||||||
on the achieved savings is printed on standard error.</para>
|
|
||||||
|
|
||||||
<para>Use <option>-vv</option> or <option>-vvv</option> to get some
|
|
||||||
progress indication.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Example</title>
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-store --optimise
|
|
||||||
hashing files in `/nix/store/qhqx7l2f1kmwihc9bnxs7rc159hsxnf3-gcc-4.1.1'
|
|
||||||
<replaceable>...</replaceable>
|
|
||||||
541838819 bytes (516.74 MiB) freed by hard-linking 54143 files;
|
|
||||||
there are 114486 files with equal contents out of 215894 files in total
|
|
||||||
</screen>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<!--######################################################################-->
|
|
||||||
|
|
||||||
<refsection><title>Operation <option>--read-log</option></title>
|
|
||||||
|
|
||||||
<refsection>
|
|
||||||
<title>Synopsis</title>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-store</command>
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='plain'><option>--read-log</option></arg>
|
|
||||||
<arg choice='plain'><option>-l</option></arg>
|
|
||||||
</group>
|
|
||||||
<arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The operation <option>--read-log</option> prints the build log
|
|
||||||
of the specified store paths on standard output. The build log is
|
|
||||||
whatever the builder of a derivation wrote to standard output and
|
|
||||||
standard error. If a store path is not a derivation, the deriver of
|
|
||||||
the store path is used.</para>
|
|
||||||
|
|
||||||
<para>Build logs are kept in
|
|
||||||
<filename>/nix/var/log/nix/drvs</filename>. However, there is no
|
|
||||||
guarantee that a build log is available for any particular store
|
|
||||||
path. For instance, if the path was downloaded as a pre-built binary
|
|
||||||
through a substitute, then the log is unavailable.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Example</title>
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-store -l $(which ktorrent)
|
|
||||||
building /nix/store/dhc73pvzpnzxhdgpimsd9sw39di66ph1-ktorrent-2.2.1
|
|
||||||
unpacking sources
|
|
||||||
unpacking source archive /nix/store/p8n1jpqs27mgkjw07pb5269717nzf5f8-ktorrent-2.2.1.tar.gz
|
|
||||||
ktorrent-2.2.1/
|
|
||||||
ktorrent-2.2.1/NEWS
|
|
||||||
<replaceable>...</replaceable>
|
|
||||||
</screen>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<!--######################################################################-->
|
|
||||||
|
|
||||||
<refsection><title>Operation <option>--dump-db</option></title>
|
|
||||||
|
|
||||||
<refsection>
|
|
||||||
<title>Synopsis</title>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-store</command>
|
|
||||||
<arg choice='plain'><option>--dump-db</option></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The operation <option>--dump-db</option> writes a dump of the
|
|
||||||
Nix database to standard output. It can be loaded into an empty Nix
|
|
||||||
store using <option>--load-db</option>. This is useful for making
|
|
||||||
backups and when migrating to different database schemas.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
<!--######################################################################-->
|
|
||||||
|
|
||||||
<refsection><title>Operation <option>--dump-db</option></title>
|
|
||||||
|
|
||||||
<refsection>
|
|
||||||
<title>Synopsis</title>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-store</command>
|
|
||||||
<arg choice='plain'><option>--load-db</option></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The operation <option>--load-db</option> reads a dump of the Nix
|
|
||||||
database created by <option>--dump-db</option> from standard input and
|
|
||||||
loads it into the Nix database.</para>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
|
|
||||||
</refentry>
|
</refentry>
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<refentry xmlns="http://docbook.org/ns/docbook"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
xml:id="sec-nix-worker">
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>nix-worker</refentrytitle>
|
|
||||||
<manvolnum>8</manvolnum>
|
|
||||||
<refmiscinfo class="source">Nix</refmiscinfo>
|
|
||||||
<refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
|
||||||
<refname>nix-worker</refname>
|
|
||||||
<refpurpose>Nix multi-user support daemon</refpurpose>
|
|
||||||
</refnamediv>
|
|
||||||
|
|
||||||
<refsynopsisdiv>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>nix-worker</command>
|
|
||||||
<arg choice="plain"><option>--daemon</option></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsynopsisdiv>
|
|
||||||
|
|
||||||
|
|
||||||
<refsection><title>Description</title>
|
|
||||||
|
|
||||||
<para>The Nix daemon is necessary in multi-user Nix installations. It
|
|
||||||
performs build actions and other operations on the Nix store on behalf
|
|
||||||
of unprivileged users.</para>
|
|
||||||
|
|
||||||
|
|
||||||
</refsection>
|
|
||||||
|
|
||||||
</refentry>
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<nop xmlns="http://docbook.org/ns/docbook">
|
<nop>
|
||||||
|
|
||||||
<arg><option>--help</option></arg>
|
<arg><option>--help</option></arg>
|
||||||
<arg><option>--version</option></arg>
|
<arg><option>--version</option></arg>
|
||||||
@@ -13,14 +13,6 @@
|
|||||||
</group>
|
</group>
|
||||||
<replaceable>number</replaceable>
|
<replaceable>number</replaceable>
|
||||||
</arg>
|
</arg>
|
||||||
<arg>
|
|
||||||
<arg><option>--cores</option></arg>
|
|
||||||
<replaceable>number</replaceable>
|
|
||||||
</arg>
|
|
||||||
<arg>
|
|
||||||
<arg><option>--max-silent-time</option></arg>
|
|
||||||
<replaceable>number</replaceable>
|
|
||||||
</arg>
|
|
||||||
<arg><option>--keep-going</option></arg>
|
<arg><option>--keep-going</option></arg>
|
||||||
<arg><option>-k</option></arg>
|
<arg><option>-k</option></arg>
|
||||||
<arg><option>--keep-failed</option></arg>
|
<arg><option>--keep-failed</option></arg>
|
||||||
@@ -28,7 +20,5 @@
|
|||||||
<arg><option>--fallback</option></arg>
|
<arg><option>--fallback</option></arg>
|
||||||
<arg><option>--readonly-mode</option></arg>
|
<arg><option>--readonly-mode</option></arg>
|
||||||
<arg><option>--log-type</option> <replaceable>type</replaceable></arg>
|
<arg><option>--log-type</option> <replaceable>type</replaceable></arg>
|
||||||
<arg><option>--show-trace</option></arg>
|
|
||||||
<sbr />
|
|
||||||
|
|
||||||
</nop>
|
</nop>
|
||||||
+9
-130
@@ -1,7 +1,4 @@
|
|||||||
<section xmlns="http://docbook.org/ns/docbook" xml:id="sec-common-options">
|
<sect1 id="sec-common-options"><title>Common options</title>
|
||||||
|
|
||||||
<title>Common options</title>
|
|
||||||
|
|
||||||
|
|
||||||
<para>Most Nix commands accept the following command-line options:</para>
|
<para>Most Nix commands accept the following command-line options:</para>
|
||||||
|
|
||||||
@@ -89,49 +86,16 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="opt-max-jobs"><term><option>--max-jobs</option></term>
|
<varlistentry id="opt-max-jobs"><term><option>--max-jobs</option></term>
|
||||||
<term><option>-j</option></term>
|
<term><option>-j</option></term>
|
||||||
|
|
||||||
<listitem><para>Sets the maximum number of build jobs that Nix will
|
<listitem><para>Sets the maximum number of build jobs that Nix will
|
||||||
perform in parallel to the specified number. The default is
|
perform in parallel to the specified number. The default is 1. A
|
||||||
specified by the <link
|
higher value is useful on SMP systems or to exploit I/O latency.</para></listitem>
|
||||||
linkend='conf-build-max-jobs'><literal>build-max-jobs</literal></link>
|
|
||||||
configuration setting, which itself defaults to
|
|
||||||
<literal>1</literal>. A higher value is useful on SMP systems or to
|
|
||||||
exploit I/O latency.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="opt-cores"><term><option>--cores</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Sets the value of the <envar>NIX_BUILD_CORES</envar>
|
|
||||||
environment variable in the invocation of builders. Builders can
|
|
||||||
use this variable at their discretion to control the maximum amount
|
|
||||||
of parallelism. For instance, in Nixpkgs, if the derivation
|
|
||||||
attribute <varname>enableParallelBuilding</varname> is set to
|
|
||||||
<literal>true</literal>, the builder passes the
|
|
||||||
<option>-j<replaceable>N</replaceable></option> flag to GNU Make.
|
|
||||||
It defaults to the value of the <link
|
|
||||||
linkend='conf-build-cores'><literal>build-cores</literal></link>
|
|
||||||
configuration setting, if set, or <literal>1</literal> otherwise.
|
|
||||||
The value <literal>0</literal> means that the builder should use all
|
|
||||||
available CPU cores in the system.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="opt-max-silent-time"><term><option>--max-silent-time</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Sets the maximum number of seconds that a builder
|
|
||||||
can go without producing any data on standard output or standard
|
|
||||||
error. The default is specified by the <link
|
|
||||||
linkend='conf-build-max-silent-time'><literal>build-max-silent-time</literal></link>
|
|
||||||
configuration setting. <literal>0</literal> means no
|
|
||||||
time-out.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--keep-going</option></term>
|
<varlistentry><term><option>--keep-going</option></term>
|
||||||
<term><option>-k</option></term>
|
<term><option>-k</option></term>
|
||||||
|
|
||||||
@@ -191,7 +155,7 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="opt-log-type"><term><option>--log-type</option>
|
<varlistentry id="opt-log-type"><term><option>--log-type</option>
|
||||||
<replaceable>type</replaceable></term>
|
<replaceable>type</replaceable></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -223,9 +187,9 @@
|
|||||||
<varlistentry><term><literal>escapes</literal></term>
|
<varlistentry><term><literal>escapes</literal></term>
|
||||||
|
|
||||||
<listitem><para>Indicate nesting using escape codes that can be
|
<listitem><para>Indicate nesting using escape codes that can be
|
||||||
interpreted by the <command>nix-log2xml</command> tool in the
|
interpreted by the <command>log2xml</command> tool in the Nix
|
||||||
Nix source distribution. The resulting XML file can be fed into
|
source distribution. The resulting XML file can be fed into the
|
||||||
the <command>log2html.xsl</command> stylesheet to create an HTML
|
<command>log2html.xsl</command> stylesheet to create an HTML
|
||||||
file that can be browsed interactively, using Javascript to
|
file that can be browsed interactively, using Javascript to
|
||||||
expand and collapse parts of the output.</para></listitem>
|
expand and collapse parts of the output.</para></listitem>
|
||||||
|
|
||||||
@@ -246,92 +210,7 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>This option is accepted by
|
|
||||||
<command>nix-env</command>, <command>nix-instantiate</command> and
|
|
||||||
<command>nix-build</command>. When evaluating Nix expressions, the
|
|
||||||
expression evaluator will automatically try to call functions that
|
|
||||||
it encounters. It can automatically call functions for which every
|
|
||||||
argument has a <link linkend='ss-functions'>default value</link>
|
|
||||||
(e.g., <literal>{<replaceable>argName</replaceable> ?
|
|
||||||
<replaceable>defaultValue</replaceable>}:
|
|
||||||
<replaceable>...</replaceable></literal>). With
|
|
||||||
<option>--arg</option>, you can also call functions that have
|
|
||||||
arguments without a default value (or override a default value).
|
|
||||||
That is, if the evaluator encounters a function with an argument
|
|
||||||
named <replaceable>name</replaceable>, it will call it with value
|
|
||||||
<replaceable>value</replaceable>.</para>
|
|
||||||
|
|
||||||
<para>For instance, the file
|
|
||||||
<literal>pkgs/top-level/all-packages.nix</literal> in Nixpkgs is
|
|
||||||
actually a function:
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
{ # The system (e.g., `i686-linux') for which to build the packages.
|
|
||||||
system ? builtins.currentSystem
|
|
||||||
<replaceable>...</replaceable>
|
|
||||||
}: <replaceable>...</replaceable></programlisting>
|
|
||||||
|
|
||||||
So if you call this Nix expression (e.g., when you do
|
|
||||||
<literal>nix-env -i <replaceable>pkgname</replaceable></literal>),
|
|
||||||
the function will be called automatically using the value <link
|
|
||||||
linkend='builtin-currentSystem'><literal>builtins.currentSystem</literal></link>
|
|
||||||
for the <literal>system</literal> argument. You can override this
|
|
||||||
using <option>--arg</option>, e.g., <literal>nix-env -i
|
|
||||||
<replaceable>pkgname</replaceable> --arg system
|
|
||||||
\"i686-freebsd\"</literal>. (Note that since the argument is a Nix
|
|
||||||
string literal, you have to escape the quotes.)</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><option>--argstr</option> <replaceable>name</replaceable> <replaceable>value</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>This option is like <option>--arg</option>, only the
|
|
||||||
value is not a Nix expression but a string. So instead of
|
|
||||||
<literal>--arg system \"i686-linux\"</literal> (the outer quotes are
|
|
||||||
to keep the shell happy) you can say <literal>--argstr system
|
|
||||||
i686-linux</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="opt-attr"><term><option>--attr</option> / <option>-A</option>
|
|
||||||
<replaceable>attrPath</replaceable></term>
|
|
||||||
|
|
||||||
<listitem><para>In <command>nix-env</command>,
|
|
||||||
<command>nix-instantiate</command> and <command>nix-build</command>,
|
|
||||||
<option>--attr</option> allows you to select an attribute from the
|
|
||||||
top-level Nix expression being evaluated. The <emphasis>attribute
|
|
||||||
path</emphasis> <replaceable>attrPath</replaceable> is a sequence of
|
|
||||||
attribute names separated by dots. For instance, given a top-level
|
|
||||||
Nix expression <replaceable>e</replaceable>, the attribute path
|
|
||||||
<literal>xorg.xorgserver</literal> would cause the expression
|
|
||||||
<literal><replaceable>e</replaceable>.xorg.xorgserver</literal> to
|
|
||||||
be used. See <link
|
|
||||||
linkend='refsec-nix-env-install-examples'><command>nix-env
|
|
||||||
--install</command></link> for some concrete examples.</para>
|
|
||||||
|
|
||||||
<para>In addition to attribute names, you can also specify array
|
|
||||||
indices. For instance, the attribute path
|
|
||||||
<literal>foo.3.bar</literal> selects the <literal>bar</literal>
|
|
||||||
attribute of the fourth element of the array in the
|
|
||||||
<literal>foo</literal> attribute of the top-level
|
|
||||||
expression.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><option>--show-trace</option></term>
|
|
||||||
|
|
||||||
<listitem><para>Causes Nix to print out a stack trace in case of Nix
|
|
||||||
expression evaluation errors.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</sect1>
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<nop xmlns="http://docbook.org/ns/docbook">
|
|
||||||
|
|
||||||
<arg>
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='plain'><option>--prebuilt-only</option></arg>
|
|
||||||
<arg choice='plain'><option>-b</option></arg>
|
|
||||||
</group>
|
|
||||||
</arg>
|
|
||||||
|
|
||||||
<arg>
|
|
||||||
<group choice='req'>
|
|
||||||
<arg choice='plain'><option>--attr</option></arg>
|
|
||||||
<arg choice='plain'><option>-A</option></arg>
|
|
||||||
</group>
|
|
||||||
</arg>
|
|
||||||
|
|
||||||
<arg><option>--from-expression</option></arg>
|
|
||||||
<arg><option>-E</option></arg>
|
|
||||||
|
|
||||||
<arg><option>--from-profile</option> <replaceable>path</replaceable></arg>
|
|
||||||
|
|
||||||
</nop>
|
|
||||||
@@ -1,23 +1,18 @@
|
|||||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
<chapter id='chap-package-management'><title>Package Management</title>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xml:id='chap-package-management'>
|
|
||||||
|
|
||||||
<title>Package Management</title>
|
|
||||||
|
|
||||||
|
|
||||||
<para>This chapter discusses how to do package management with Nix,
|
<para>This chapter discusses how to do package management with Nix,
|
||||||
i.e., how to obtain, install, upgrade, and erase packages. This is
|
i.e., how to obtain, install, upgrade, and erase components. This is
|
||||||
the “user’s” perspective of the Nix system — people
|
the “user’s” perspective of the Nix system — people
|
||||||
who want to <emphasis>create</emphasis> packages should consult
|
who want to <emphasis>create</emphasis> components should consult
|
||||||
<xref linkend='chap-writing-nix-expressions' />.</para>
|
<xref linkend='chap-writing-nix-expressions' />.</para>
|
||||||
|
|
||||||
|
|
||||||
<section><title>Basic package management</title>
|
<sect1><title>Basic package management</title>
|
||||||
|
|
||||||
<para>The main command for package management is <link
|
<para>The main command for package management is <link
|
||||||
linkend="sec-nix-env"><command>nix-env</command></link>. You can use
|
linkend="sec-nix-env"><command>nix-env</command></link>. You can use
|
||||||
it to install, upgrade, and erase packages, and to query what
|
it to install, upgrade, and erase components, and to query what
|
||||||
packages are installed or are available for installation.</para>
|
components are installed or are available for installation.</para>
|
||||||
|
|
||||||
<para>In Nix, different users can have different “views”
|
<para>In Nix, different users can have different “views”
|
||||||
on the set of installed applications. That is, there might be lots of
|
on the set of installed applications. That is, there might be lots of
|
||||||
@@ -30,21 +25,21 @@ environment</emphasis>, which is just a directory tree consisting of
|
|||||||
symlinks to the files of the active applications. </para>
|
symlinks to the files of the active applications. </para>
|
||||||
|
|
||||||
<para>Components are installed from a set of <emphasis>Nix
|
<para>Components are installed from a set of <emphasis>Nix
|
||||||
expressions</emphasis> that tell Nix how to build those packages,
|
expressions</emphasis> that tell Nix how to build those components,
|
||||||
including, if necessary, their dependencies. There is a collection of
|
including, if necessary, their dependencies. There is a collection of
|
||||||
Nix expressions called the Nix Package collection that contains
|
Nix expressions called the Nix Package collection that contains
|
||||||
packages ranging from basic development stuff such as GCC and Glibc,
|
components ranging from basic development stuff such as GCC and Glibc,
|
||||||
to end-user applications like Mozilla Firefox. (Nix is however not
|
to end-user applications like Mozilla Firefox. (Nix is however not
|
||||||
tied to the Nix Package collection; you could write your own Nix
|
tied to the Nix Package collection; you could write your own Nix
|
||||||
expressions based on it, or completely new ones.) You can download
|
expressions based on it, or completely new ones.) You can download
|
||||||
the latest version from <link
|
the latest version from <ulink
|
||||||
xlink:href='http://nixos.org/nixpkgs/download.html' />.</para>
|
url='http://catamaran.labs.cs.uu.nl/dist/nix' />.</para>
|
||||||
|
|
||||||
<para>Assuming that you have downloaded and unpacked a release of Nix
|
<para>Assuming that you have downloaded and unpacked a release of Nix
|
||||||
Packages, you can view the set of available packages in the release:
|
Packages, you can view the set of available components in the release:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-env -qaf nixpkgs-<replaceable>version</replaceable> '*'
|
$ nix-env -qaf nixpkgs-<replaceable>version</replaceable>
|
||||||
ant-blackdown-1.4.2
|
ant-blackdown-1.4.2
|
||||||
aterm-2.2
|
aterm-2.2
|
||||||
bash-3.0
|
bash-3.0
|
||||||
@@ -55,30 +50,14 @@ bzip2-1.0.2
|
|||||||
...</screen>
|
...</screen>
|
||||||
|
|
||||||
where <literal>nixpkgs-<replaceable>version</replaceable></literal> is
|
where <literal>nixpkgs-<replaceable>version</replaceable></literal> is
|
||||||
where you’ve unpacked the release. The flag <option>-q</option>
|
where you’ve unpacked the release.</para>
|
||||||
specifies a query operation; <option>-a</option> means that you want
|
|
||||||
to show the “available” (i.e., installable) packages, as opposed to
|
|
||||||
the installed packages; and <option>-f</option>
|
|
||||||
<filename>nixpkgs-<replaceable>version</replaceable></filename>
|
|
||||||
specifies the source of the packages. The argument
|
|
||||||
<literal>'*'</literal> shows all installable packages. (The quotes are
|
|
||||||
necessary to prevent shell expansion.) You can also select specific
|
|
||||||
packages by name:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-env -qaf nixpkgs-<replaceable>version</replaceable> gcc
|
|
||||||
gcc-3.4.6
|
|
||||||
gcc-4.0.3
|
|
||||||
gcc-4.1.1</screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>It is also possible to see the <emphasis>status</emphasis> of
|
<para>It is also possible to see the <emphasis>status</emphasis> of
|
||||||
available packages, i.e., whether they are installed into the user
|
available components, i.e., whether they are installed into the user
|
||||||
environment and/or present in the system:
|
environment and/or present in the system:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-env -qasf nixpkgs-<replaceable>version</replaceable> '*'
|
$ nix-env -qasf nixpkgs-<replaceable>version</replaceable>
|
||||||
...
|
...
|
||||||
-PS bash-3.0
|
-PS bash-3.0
|
||||||
--S binutils-2.15
|
--S binutils-2.15
|
||||||
@@ -86,48 +65,49 @@ IPS bison-1.875d
|
|||||||
...</screen>
|
...</screen>
|
||||||
|
|
||||||
The first character (<literal>I</literal>) indicates whether the
|
The first character (<literal>I</literal>) indicates whether the
|
||||||
package is installed in your current user environment. The second
|
component is installed in your current user environment. The second
|
||||||
(<literal>P</literal>) indicates whether it is present on your system
|
(<literal>P</literal>) indicates whether it is present on your system
|
||||||
(in which case installing it into your user environment would be a
|
(in which case installing it into your user environment would be a
|
||||||
very quick operation). The last one (<literal>S</literal>) indicates
|
very quick operation). The last one (<literal>S</literal>) indicates
|
||||||
whether there is a so-called <emphasis>substitute</emphasis> for the
|
whether there is a so-called <emphasis>substitute</emphasis> for the
|
||||||
package, which is Nix’s mechanism for doing binary deployment. It
|
component, which is Nix’s mechanism for doing binary deployment. It
|
||||||
just means that Nix knows that it can fetch a pre-built package from
|
just means that Nix know that it can fetch a pre-built component from
|
||||||
somewhere (typically a network server) instead of building it
|
somewhere (typically a network server) instead of building it
|
||||||
locally.</para>
|
locally.</para>
|
||||||
|
|
||||||
<para>So now that we have a set of Nix expressions we can build the
|
<para>So now that we have a set of Nix expressions we can build the
|
||||||
packages contained in them. This is done using <literal>nix-env
|
components contained in them. This is done using <literal>nix-env
|
||||||
-i</literal>. For instance,
|
-i</literal>. For instance,
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-env -f nixpkgs-<replaceable>version</replaceable> -i subversion</screen>
|
$ nix-env -f nixpkgs-<replaceable>version</replaceable> -i subversion</screen>
|
||||||
|
|
||||||
will install the package called <literal>subversion</literal> (which
|
will install the component called <literal>subversion</literal> (which
|
||||||
is, of course, the <link
|
is, of course, the <ulink
|
||||||
xlink:href='http://subversion.tigris.org/'>Subversion version
|
url='http://subversion.tigris.org/'>Subversion version management
|
||||||
management system</link>).</para>
|
system</ulink>).</para>
|
||||||
|
|
||||||
<para>When you do this for the first time, Nix will start building
|
<para>When you do this for the first time, Nix will start building
|
||||||
Subversion and all its dependencies. This will take quite a while —
|
Subversion and all its dependencies. This will take quite a while —
|
||||||
typically an hour or two on modern machines. Fortunately, there is a
|
typically an hour or two on modern machines. Fortunately, there is a
|
||||||
faster way (so do a Ctrl-C on that install operation!): you just need
|
faster way (so do a Ctrl-C on that install operation!): you just need
|
||||||
to tell Nix that pre-built binaries of all those packages are
|
to tell Nix that pre-built binaries of all those components are
|
||||||
available somewhere. This is done using the
|
available somewhere. This is done using the
|
||||||
<command>nix-pull</command> command, which must be supplied with a URL
|
<command>nix-pull</command> command, which must be supplied with a URL
|
||||||
containing a <emphasis>manifest</emphasis> describing what binaries
|
containing a <emphasis>manifest</emphasis> describing what binaries
|
||||||
are available. This URL should correspond to the Nix Packages release
|
are available. This URL should correspond to the Nix Packages release
|
||||||
that you’re using. For instance, if you obtained a release from <link
|
that you’re using. For instance, if you obtained a release from
|
||||||
xlink:href='http://nixos.org/releases/nixpkgs/nixpkgs-0.12pre11712-4lrp7j8x'
|
<ulink
|
||||||
/>, then you should do:
|
url='http://catamaran.labs.cs.uu.nl/dist/nix/nixpkgs-0.6pre1554/' />,
|
||||||
|
then you should do:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-pull http://nixos.org/releases/nixpkgs/nixpkgs-0.12pre11712-4lrp7j8x/MANIFEST</screen>
|
$ nix-pull http://catamaran.labs.cs.uu.nl/dist/nix/nixpkgs-0.6pre1554/MANIFEST</screen>
|
||||||
|
|
||||||
If you then issue the installation command, it should start
|
If you then issue the installation command, it should start
|
||||||
downloading binaries from <systemitem
|
downloading binaries from <systemitem
|
||||||
class='fqdomainname'>nixos.org</systemitem>, instead of building
|
class='fqdomainname'>catamaran.labs.cs.uu.nl</systemitem>, instead of
|
||||||
them from source. This might still take a while since all
|
building them from source. This might still take a while since all
|
||||||
dependencies must be downloaded, but on a reasonably fast connection
|
dependencies must be downloaded, but on a reasonably fast connection
|
||||||
such as an DSL line it’s on the order of a few minutes.</para>
|
such as an DSL line it’s on the order of a few minutes.</para>
|
||||||
|
|
||||||
@@ -153,7 +133,7 @@ expressions, use <parameter>-i</parameter> instead of
|
|||||||
<parameter>-u</parameter>; <parameter>-i</parameter> will remove
|
<parameter>-u</parameter>; <parameter>-i</parameter> will remove
|
||||||
whatever version is already installed.</para>
|
whatever version is already installed.</para>
|
||||||
|
|
||||||
<para>You can also upgrade all packages for which there are newer
|
<para>You can also upgrade all components for which there are newer
|
||||||
versions:
|
versions:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
@@ -190,33 +170,33 @@ since <literal>nix-channel --update</literal> calls <literal>nix-env
|
|||||||
from the channel, replacing whatever default you had
|
from the channel, replacing whatever default you had
|
||||||
set.</para></footnote></para>
|
set.</para></footnote></para>
|
||||||
|
|
||||||
</section>
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
<section xml:id="sec-profiles"><title>Profiles</title>
|
<sect1 id="sec-profiles"><title>Profiles</title>
|
||||||
|
|
||||||
<para>Profiles and user environments are Nix’s mechanism for
|
<para>Profiles and user environments are Nix’s mechanism for
|
||||||
implementing the ability to allow different users to have different
|
implementing the ability to allow differens users to have different
|
||||||
configurations, and to do atomic upgrades and rollbacks. To
|
configurations, and to do atomic upgrades and rollbacks. To
|
||||||
understand how they work, it’s useful to know a bit about how Nix
|
understand how they work, it’s useful to know a bit about how Nix
|
||||||
works. In Nix, packages are stored in unique locations in the
|
works. In Nix, components are stored in unique locations in the
|
||||||
<emphasis>Nix store</emphasis> (typically,
|
<emphasis>Nix store</emphasis> (typically,
|
||||||
<filename>/nix/store</filename>). For instance, a particular version
|
<filename>/nix/store</filename>). For instance, a particular version
|
||||||
of the Subversion package might be stored in a directory
|
of the Subversion component might be stored in a directory
|
||||||
<filename>/nix/store/dpmvp969yhdqs7lm2r1a3gng7pyq6vy4-subversion-1.1.3/</filename>,
|
<filename>/nix/store/dpmvp969yhdqs7lm2r1a3gng7pyq6vy4-subversion-1.1.3/</filename>,
|
||||||
while another version might be stored in
|
while another version might be stored in
|
||||||
<filename>/nix/store/5mq2jcn36ldlmh93yj1n8s9c95pj7c5s-subversion-1.1.2</filename>.
|
<filename>/nix/store/5mq2jcn36ldlmh93yj1n8s9c95pj7c5s-subversion-1.1.2</filename>.
|
||||||
The long strings prefixed to the directory names are cryptographic
|
The long strings prefixed to the directory names are cryptographic
|
||||||
hashes<footnote><para>160-bit truncations of SHA-256 hashes encoded in
|
hashes<footnote><para>160-bit truncations of SHA-256 hashes encoded in
|
||||||
a base-32 notation, to be precise.</para></footnote> of
|
a base-32 notation, to be precise.</para></footnote> of
|
||||||
<emphasis>all</emphasis> inputs involved in building the package —
|
<emphasis>all</emphasis> inputs involved in building the component —
|
||||||
sources, dependencies, compiler flags, and so on. So if two
|
sources, dependencies, compiler flags, and so on. So if two
|
||||||
packages differ in any way, they end up in different locations in
|
components differ in any way, they end up in different locations in
|
||||||
the file system, so they don’t interfere with each other. <xref
|
the file system, so they don’t interfere with each other. <xref
|
||||||
linkend='fig-user-environments' /> shows a part of a typical Nix
|
linkend='fig-user-environments' /> shows a part of a typical Nix
|
||||||
store.</para>
|
store.</para>
|
||||||
|
|
||||||
<figure xml:id='fig-user-environments'><title>User environments</title>
|
<figure id='fig-user-environments'><title>User environments</title>
|
||||||
<mediaobject>
|
<mediaobject>
|
||||||
<imageobject>
|
<imageobject>
|
||||||
<imagedata fileref='figures/user-environments.png' format='PNG' />
|
<imagedata fileref='figures/user-environments.png' format='PNG' />
|
||||||
@@ -231,12 +211,12 @@ $ /nix/store/dpmvp969yhdq...-subversion-1.1.3/bin/svn</screen>
|
|||||||
|
|
||||||
every time you want to run Subversion. Of course we could set up the
|
every time you want to run Subversion. Of course we could set up the
|
||||||
<envar>PATH</envar> environment variable to include the
|
<envar>PATH</envar> environment variable to include the
|
||||||
<filename>bin</filename> directory of every package we want to use,
|
<filename>bin</filename> directory of every component we want to use,
|
||||||
but this is not very convenient since changing <envar>PATH</envar>
|
but this is not very convenient since changing <envar>PATH</envar>
|
||||||
doesn’t take effect for already existing processes. The solution Nix
|
doesn’t take effect for already existing processes. The solution Nix
|
||||||
uses is to create directory trees of symlinks to
|
uses is to create directory trees of symlinks to
|
||||||
<emphasis>activated</emphasis> packages. These are called
|
<emphasis>activated</emphasis> components. These are called
|
||||||
<emphasis>user environments</emphasis> and they are packages
|
<emphasis>user environments</emphasis> and they are components
|
||||||
themselves (though automatically generated by
|
themselves (though automatically generated by
|
||||||
<command>nix-env</command>), so they too reside in the Nix store. For
|
<command>nix-env</command>), so they too reside in the Nix store. For
|
||||||
instance, in <xref linkend='fig-user-environments' /> the user
|
instance, in <xref linkend='fig-user-environments' /> the user
|
||||||
@@ -285,8 +265,8 @@ operation, a new user environment and generation link are created
|
|||||||
based on the current one, and finally the <filename>default</filename>
|
based on the current one, and finally the <filename>default</filename>
|
||||||
symlink is made to point at the new generation. This last step is
|
symlink is made to point at the new generation. This last step is
|
||||||
atomic on Unix, which explains how we can do atomic upgrades. (Note
|
atomic on Unix, which explains how we can do atomic upgrades. (Note
|
||||||
that the building/installing of new packages doesn’t interfere in
|
that the building/installing of new components doesn’t interfere in
|
||||||
any way with old packages, since they are stored in different
|
any way with old components, since they are stored in different
|
||||||
locations in the Nix store.)</para>
|
locations in the Nix store.)</para>
|
||||||
|
|
||||||
<para>If you find that you want to undo a <command>nix-env</command>
|
<para>If you find that you want to undo a <command>nix-env</command>
|
||||||
@@ -331,7 +311,7 @@ default profile, respectively. If the profile doesn’t exist, it will
|
|||||||
be created automatically. You should be careful about storing a
|
be created automatically. You should be careful about storing a
|
||||||
profile in another location than the <filename>profiles</filename>
|
profile in another location than the <filename>profiles</filename>
|
||||||
directory, since otherwise it might not be used as a root of the
|
directory, since otherwise it might not be used as a root of the
|
||||||
garbage collector (see <xref linkend='sec-garbage-collection'
|
garbage collector (see section <xref linkend='sec-garbage-collection'
|
||||||
/>).</para>
|
/>).</para>
|
||||||
|
|
||||||
<para>All <command>nix-env</command> operations work on the profile
|
<para>All <command>nix-env</command> operations work on the profile
|
||||||
@@ -345,25 +325,25 @@ $ nix-env -p /nix/var/nix/profiles/other-profile -i subversion</screen>
|
|||||||
This will <emphasis>not</emphasis> change the
|
This will <emphasis>not</emphasis> change the
|
||||||
<command>~/.nix-profile</command> symlink.</para>
|
<command>~/.nix-profile</command> symlink.</para>
|
||||||
|
|
||||||
</section>
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
<section xml:id='sec-garbage-collection'><title>Garbage collection</title>
|
<sect1 id='sec-garbage-collection'><title>Garbage collection</title>
|
||||||
|
|
||||||
<para><command>nix-env</command> operations such as upgrades
|
<para><command>nix-env</command> operations such as upgrades
|
||||||
(<option>-u</option>) and uninstall (<option>-e</option>) never
|
(<option>-u</option>) and uninstall (<option>-e</option>) never
|
||||||
actually delete packages from the system. All they do (as shown
|
actually delete components from the system. All they do (as shown
|
||||||
above) is to create a new user environment that no longer contains
|
above) is to create a new user environment that no longer contains
|
||||||
symlinks to the “deleted” packages.</para>
|
symlinks to the “deleted” components.</para>
|
||||||
|
|
||||||
<para>Of course, since disk space is not infinite, unused packages
|
<para>Of course, since disk space is not infinite, unused components
|
||||||
should be removed at some point. You can do this by running the Nix
|
should be removed at some point. You can do this by running the Nix
|
||||||
garbage collector. It will remove from the Nix store any package
|
garbage collector. It will remove from the Nix store any component
|
||||||
not used (directly or indirectly) by any generation of any
|
not used (directly or indirectly) by any generation of any
|
||||||
profile.</para>
|
profile.</para>
|
||||||
|
|
||||||
<para>Note however that as long as old generations reference a
|
<para>Note however that as long as old generations reference a
|
||||||
package, it will not be deleted. After all, we wouldn’t be able to
|
component, it will not be deleted. After all, we wouldn’t be able to
|
||||||
do a rollback otherwise. So in order for garbage collection to be
|
do a rollback otherwise. So in order for garbage collection to be
|
||||||
effective, you should also delete (some) old generations. Of course,
|
effective, you should also delete (some) old generations. Of course,
|
||||||
this should only be done if you are certain that you will not need to
|
this should only be done if you are certain that you will not need to
|
||||||
@@ -398,21 +378,8 @@ $ nix-store --gc --print-dead</screen>
|
|||||||
Likewise, the option <option>--print-live</option> will show the paths
|
Likewise, the option <option>--print-live</option> will show the paths
|
||||||
that <emphasis>won’t</emphasis> be deleted.</para>
|
that <emphasis>won’t</emphasis> be deleted.</para>
|
||||||
|
|
||||||
<para>There is also a convenient little utility
|
|
||||||
<command>nix-collect-garbage</command>, which when invoked with the
|
|
||||||
<option>-d</option> (<option>--delete-old</option>) switch deletes all
|
|
||||||
old generations of all profiles in
|
|
||||||
<filename>/nix/var/nix/profiles</filename>. So
|
|
||||||
|
|
||||||
<screen>
|
<sect2 id="ssec-gc-roots"><title>Garbage collector roots</title>
|
||||||
$ nix-collect-garbage -d</screen>
|
|
||||||
|
|
||||||
is a quick and easy way to clean up your system.</para>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<section xml:id="ssec-gc-roots"><title>Garbage collector roots</title>
|
|
||||||
|
|
||||||
<para>The roots of the garbage collector are all store paths to which
|
<para>The roots of the garbage collector are all store paths to which
|
||||||
there are symlinks in the directory
|
there are symlinks in the directory
|
||||||
@@ -434,12 +401,12 @@ followed and searched for roots, but symlinks to non-store paths
|
|||||||
<emphasis>inside</emphasis> the paths reached in that way are not
|
<emphasis>inside</emphasis> the paths reached in that way are not
|
||||||
followed to prevent infinite recursion.</para>
|
followed to prevent infinite recursion.</para>
|
||||||
|
|
||||||
</section>
|
</sect2>
|
||||||
|
|
||||||
</section>
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
<section xml:id="sec-channels"><title>Channels</title>
|
<sect1 id="sec-channels"><title>Channels</title>
|
||||||
|
|
||||||
<para>If you want to stay up to date with a set of packages, it’s not
|
<para>If you want to stay up to date with a set of packages, it’s not
|
||||||
very convenient to manually download the latest set of Nix expressions
|
very convenient to manually download the latest set of Nix expressions
|
||||||
@@ -458,7 +425,7 @@ URL.</para>
|
|||||||
<command>nix-channel --add</command>, e.g.,
|
<command>nix-channel --add</command>, e.g.,
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-channel --add http://nixos.org/releases/nixpkgs/channels/nixpkgs-unstable</screen>
|
$ nix-channel --add http://catamaran.labs.cs.uu.nl/dist/nix/channels/nixpkgs-unstable</screen>
|
||||||
|
|
||||||
subscribes you to a channel that always contains that latest version
|
subscribes you to a channel that always contains that latest version
|
||||||
of the Nix Packages collection. (Instead of
|
of the Nix Packages collection. (Instead of
|
||||||
@@ -486,121 +453,10 @@ makes the union of each channel’s Nix expressions the default for
|
|||||||
<screen>
|
<screen>
|
||||||
$ nix-env -u '*'</screen>
|
$ nix-env -u '*'</screen>
|
||||||
|
|
||||||
to upgrade all packages in your profile to the latest versions
|
to upgrade all components in your profile to the latest versions
|
||||||
available in the subscribed channels.</para>
|
available in the subscribed channels.</para>
|
||||||
|
|
||||||
</section>
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
<section xml:id="sec-one-click"><title>One-click installs</title>
|
|
||||||
|
|
||||||
<para>Often, when you want to install a specific package (e.g., from
|
|
||||||
the <link
|
|
||||||
xlink:href="http://nixos.org/nixpkgs/">Nix
|
|
||||||
Packages collection</link>), subscribing to a channel is a bit
|
|
||||||
cumbersome. And channels don’t help you at all if you want to install
|
|
||||||
an older version of a package than the one provided by the current
|
|
||||||
contents of the channel, or a package that has been removed from the
|
|
||||||
channel. That’s when <emphasis>one-click installs</emphasis> come in
|
|
||||||
handy: you can just go to the web page that contains the package,
|
|
||||||
click on it, and it will be installed with all the necessary
|
|
||||||
dependencies.</para>
|
|
||||||
|
|
||||||
<para>For instance, you can go to <link
|
|
||||||
xlink:href="http://hydra.nixos.org/jobset/nixpkgs/trunk/channel/latest"
|
|
||||||
/> and click on any link for the individual packages for your
|
|
||||||
platform. The first time you do this, your browser will ask what to
|
|
||||||
do with <literal>application/nix-package</literal> files. You should
|
|
||||||
open them with <filename>/nix/bin/nix-install-package</filename>.
|
|
||||||
This will open a window that asks you to confirm that you want to
|
|
||||||
install the package. When you answer <literal>Y</literal>, the
|
|
||||||
package and all its dependencies will be installed. This is a binary
|
|
||||||
deployment mechanism — you get packages pre-compiled for the selected
|
|
||||||
platform type.</para>
|
|
||||||
|
|
||||||
<para>You can also install <literal>application/nix-package</literal>
|
|
||||||
files from the command line directly. See <xref
|
|
||||||
linkend='sec-nix-install-package' /> for details.</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<section xml:id="sec-sharing-packages"><title>Sharing packages between machines</title>
|
|
||||||
|
|
||||||
<para>Sometimes you want to copy a package from one machine to
|
|
||||||
another. Or, you want to install some packages and you know that
|
|
||||||
another machine already has some or all of those packages or their
|
|
||||||
dependencies. In that case there are mechanisms to quickly copy
|
|
||||||
packages between machines.</para>
|
|
||||||
|
|
||||||
<para>The command <command
|
|
||||||
linkend="sec-nix-copy-closure">nix-copy-closure</command> copies a Nix
|
|
||||||
store path along with all its dependencies to or from another machine
|
|
||||||
via the SSH protocol. It doesn’t copy store paths that are already
|
|
||||||
present on the target machine. For example, the following command
|
|
||||||
copies Firefox with all its dependencies:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-copy-closure --to alice@itchy.example.org $(type -p firefox)</screen>
|
|
||||||
|
|
||||||
See <xref linkend='sec-nix-copy-closure' /> for details.</para>
|
|
||||||
|
|
||||||
<para>With <command linkend='refsec-nix-store-export'>nix-store
|
|
||||||
--export</command> and <command
|
|
||||||
linkend='refsec-nix-store-import'>nix-store --import</command> you can
|
|
||||||
write the closure of a store path (that is, the path and all its
|
|
||||||
dependencies) to a file, and then unpack that file into another Nix
|
|
||||||
store. For example,
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-store --export $(type -p firefox) > firefox.closure</screen>
|
|
||||||
|
|
||||||
writes the closure of Firefox to a file. You can then copy this file
|
|
||||||
to another machine and install the closure:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-store --import < firefox.closure</screen>
|
|
||||||
|
|
||||||
Any store paths in the closure that are already present in the target
|
|
||||||
store are ignored. It is also possible to pipe the export into
|
|
||||||
another command, e.g. to copy and install a closure directly to/on
|
|
||||||
another machine:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-store --export $(type -p firefox) | bzip2 | \
|
|
||||||
ssh alice@itchy.example.org "bunzip2 | nix-store --import"</screen>
|
|
||||||
|
|
||||||
But note that <command>nix-copy-closure</command> is generally more
|
|
||||||
efficient in this example because it only copies paths that are not
|
|
||||||
already present in the target Nix store.</para>
|
|
||||||
|
|
||||||
<para>Finally, if you can mount the Nix store of a remote machine in
|
|
||||||
your local filesystem, Nix can copy paths from the remote Nix store to
|
|
||||||
the local Nix store <emphasis>on demand</emphasis>. For instance,
|
|
||||||
suppose that you mount a remote machine containing a Nix store via
|
|
||||||
<command
|
|
||||||
xlink:href="http://fuse.sourceforge.net/sshfs.html">sshfs</command>:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ sshfs alice@itchy.example.org:/ /mnt</screen>
|
|
||||||
|
|
||||||
You should then set the <envar>NIX_OTHER_STORES</envar> environment
|
|
||||||
variable to tell Nix about this remote Nix store:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ export NIX_OTHER_STORES=/mnt/nix</screen>
|
|
||||||
|
|
||||||
Then if you do any Nix operation, e.g.
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ nix-env -i firefox</screen>
|
|
||||||
|
|
||||||
and Nix has to build a path that it sees is already present in
|
|
||||||
<filename>/mnt/nix</filename>, then it will just copy from there
|
|
||||||
instead of building it from source.</para>
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
+25
-52
@@ -1,9 +1,4 @@
|
|||||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
<chapter><title>Quick Start</title>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xml:id="chap-quick-start">
|
|
||||||
|
|
||||||
<title>Quick Start</title>
|
|
||||||
|
|
||||||
|
|
||||||
<para>This chapter is for impatient people who don't like reading
|
<para>This chapter is for impatient people who don't like reading
|
||||||
documentation. For more in-depth information you are kindly referred
|
documentation. For more in-depth information you are kindly referred
|
||||||
@@ -11,9 +6,9 @@ to the following chapters.</para>
|
|||||||
|
|
||||||
<orderedlist>
|
<orderedlist>
|
||||||
|
|
||||||
<listitem><para>Download a source tarball, RPM or Deb from <link
|
<listitem><para>Download a source tarball or RPM from <ulink
|
||||||
xlink:href='http://nixos.org/'/>. Build source distributions using
|
url='http://www.cs.uu.nl/groups/ST/Trace/Nix'/>. Build source
|
||||||
the regular sequence:
|
distributions using the regular sequence:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ tar xvfj nix-<replaceable>version</replaceable>.tar.bz2
|
$ tar xvfj nix-<replaceable>version</replaceable>.tar.bz2
|
||||||
@@ -21,28 +16,18 @@ $ ./configure
|
|||||||
$ make
|
$ make
|
||||||
$ make install <lineannotation>(as root)</lineannotation></screen>
|
$ make install <lineannotation>(as root)</lineannotation></screen>
|
||||||
|
|
||||||
This will install the Nix binaries in <filename>/usr/local</filename>
|
This will install Nix in <filename>/nix</filename>. You shouldn't
|
||||||
and keep the Nix store and other state in <filename>/nix</filename>.
|
change the prefix if at all possible since that will make it
|
||||||
You can change the former by specifying
|
impossible to use our pre-built components. Alternatively, you could
|
||||||
<option>--prefix=<replaceable>path</replaceable></option>. The
|
grab an RPM if you're on an RPM-based system. You should also add
|
||||||
location of the store can be changed using
|
<filename>/nix/etc/profile.d/nix.sh</filename> to your
|
||||||
<option>--with-store-dir=<replaceable>path</replaceable></option>.
|
<filename>~/.bashrc</filename> (or some other login
|
||||||
However, you shouldn't change the store location, if at all possible,
|
|
||||||
since that will make it impossible to use pre-built binaries from the
|
|
||||||
Nixpkgs channel and other channels. The location of the state can be
|
|
||||||
changed using
|
|
||||||
<option>--localstatedir=<replaceable>path</replaceable>.</option></para></listitem>
|
|
||||||
|
|
||||||
<listitem><para>You should add
|
|
||||||
<filename><replaceable>prefix</replaceable>/etc/profile.d/nix.sh</filename>
|
|
||||||
to your <filename>~/.bashrc</filename> (or some other login
|
|
||||||
file).</para></listitem>
|
file).</para></listitem>
|
||||||
|
|
||||||
<listitem><para>Subscribe to the Nix Packages channel.
|
<listitem><para>Subscribe to the Nix Packages channel.
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-channel --add \
|
$ nix-channel --add http://catamaran.labs.cs.uu.nl/dist/nix/channels/nixpkgs-unstable</screen>
|
||||||
http://nixos.org/releases/nixpkgs/channels/nixpkgs-unstable</screen>
|
|
||||||
|
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
|
||||||
@@ -50,17 +35,17 @@ $ nix-channel --add \
|
|||||||
<screen>
|
<screen>
|
||||||
$ nix-channel --update</screen>
|
$ nix-channel --update</screen>
|
||||||
|
|
||||||
Note that this in itself doesn't download any packages, it just
|
Note that this in itself doesn't download any components, it just
|
||||||
downloads the Nix expressions that build them and stores them
|
downloads the Nix expressions that build them and stores them
|
||||||
somewhere (under <filename>~/.nix-defexpr</filename>, in case you're
|
somewhere (under <filename>~/.nix-defexpr</filename>, in case you're
|
||||||
curious). Also, it registers the fact that pre-built binaries are
|
curious). Also, it registers the fact that pre-built binaries are
|
||||||
available remotely.</para></listitem>
|
available remotely.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>See what installable packages are currently available
|
<listitem><para>See what installable components are currently
|
||||||
in the channel:
|
available in the channel:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-env -qa \*
|
$ nix-env -qa
|
||||||
docbook-xml-4.2
|
docbook-xml-4.2
|
||||||
firefox-1.0pre-PR-0.10.1
|
firefox-1.0pre-PR-0.10.1
|
||||||
hello-2.1.1
|
hello-2.1.1
|
||||||
@@ -69,13 +54,13 @@ libxslt-1.1.0
|
|||||||
|
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
|
||||||
<listitem><para>Install some packages from the channel:
|
<listitem><para>Install some components from the channel:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-env -i hello firefox <replaceable>...</replaceable> </screen>
|
$ nix-env -i hello firefox <replaceable>...</replaceable> </screen>
|
||||||
|
|
||||||
This should download pre-built packages; it should not build them
|
This should download the pre-built components; it should not build
|
||||||
locally (if it does, something went wrong).</para></listitem>
|
them locally (if it does, something went wrong).</para></listitem>
|
||||||
|
|
||||||
<listitem><para>Test that they work:
|
<listitem><para>Test that they work:
|
||||||
|
|
||||||
@@ -102,22 +87,12 @@ $ nix-env -e hello</screen>
|
|||||||
$ nix-channel --update
|
$ nix-channel --update
|
||||||
$ nix-env -u '*'</screen>
|
$ nix-env -u '*'</screen>
|
||||||
|
|
||||||
The latter command will upgrade each installed package for which there
|
The latter command will upgrade each installed component for which
|
||||||
is a “newer” version (as determined by comparing the version
|
there is a “newer” version (as determined by comparing the version
|
||||||
numbers).</para></listitem>
|
numbers).</para></listitem>
|
||||||
|
|
||||||
<listitem><para>You can also install specific packages directly from
|
|
||||||
your web browser. For instance, you can go to <link
|
|
||||||
xlink:href="http://hydra.nixos.org/jobset/nixpkgs/trunk/channel/latest" />
|
|
||||||
and click on any link for the individual packages for your platform.
|
|
||||||
Associate <literal>application/nix-package</literal> with the program
|
|
||||||
<filename>/nix/bin/nix-install-package</filename>. A window should
|
|
||||||
appear asking you whether it’s okay to install the package. Say
|
|
||||||
<literal>Y</literal>. The package and all its dependencies will be
|
|
||||||
installed.</para></listitem>
|
|
||||||
|
|
||||||
<listitem><para>If you're unhappy with the result of a
|
<listitem><para>If you're unhappy with the result of a
|
||||||
<command>nix-env</command> action (e.g., an upgraded package turned
|
<command>nix-env</command> action (e.g., an upgraded component turned
|
||||||
out not to work properly), you can go back:
|
out not to work properly), you can go back:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
@@ -130,15 +105,13 @@ to get rid of unused packages, since uninstalls or upgrades don't
|
|||||||
actually delete them:
|
actually delete them:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-collect-garbage -d</screen>
|
$ nix-env --delete-generations old
|
||||||
|
$ nix-store --gc</screen>
|
||||||
|
|
||||||
<!--
|
|
||||||
The first command deletes old “generations” of your profile (making
|
The first command deletes old “generations” of your profile (making
|
||||||
rollbacks impossible, but also making the packages in those old
|
rollbacks impossible, but also making the components in those old
|
||||||
generations available for garbage collection), while the second
|
generations available for garbage collection), while the second
|
||||||
command actually deletes them.-->
|
command actually deletes them.</para></listitem>
|
||||||
|
|
||||||
</para></listitem>
|
|
||||||
|
|
||||||
</orderedlist>
|
</orderedlist>
|
||||||
|
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<xsl:stylesheet
|
|
||||||
version="1.0"
|
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
||||||
xmlns:str="http://exslt.org/strings"
|
|
||||||
extension-element-prefixes="str">
|
|
||||||
|
|
||||||
<xsl:output method="xml"/>
|
|
||||||
|
|
||||||
<xsl:template match="function|command|literal|varname|filename|option|quote">`<xsl:apply-templates/>'</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="token"><xsl:text> </xsl:text><xsl:apply-templates /><xsl:text>
|
|
||||||
</xsl:text></xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="screen|programlisting">
|
|
||||||
<screen><xsl:apply-templates select="str:split(., '
')" /></screen>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="section[following::section]">
|
|
||||||
<section>
|
|
||||||
<xsl:apply-templates />
|
|
||||||
<screen><xsl:text>
|
|
||||||
</xsl:text></screen>
|
|
||||||
</section>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="*">
|
|
||||||
<xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
|
|
||||||
<xsl:copy-of select="namespace::*" />
|
|
||||||
<xsl:for-each select="@*">
|
|
||||||
<xsl:attribute name="{name(.)}" namespace="{namespace-uri(.)}">
|
|
||||||
<xsl:value-of select="."/>
|
|
||||||
</xsl:attribute>
|
|
||||||
</xsl:for-each>
|
|
||||||
<xsl:apply-templates/>
|
|
||||||
</xsl:element>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="text()">
|
|
||||||
<xsl:value-of select="translate(., '‘’“”—', concat("`'", '""-'))" />
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
|
||||||
File diff suppressed because it is too large.
Load diff
+29
-83
@@ -10,6 +10,7 @@ body
|
|||||||
{
|
{
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
background: white;
|
background: white;
|
||||||
|
|
||||||
margin: 2em 1em 2em 1em;
|
margin: 2em 1em 2em 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,33 +34,16 @@ h2 /* chapters, appendices, subtitle */
|
|||||||
div.chapter > div.titlepage h2, div.appendix > div.titlepage h2
|
div.chapter > div.titlepage h2, div.appendix > div.titlepage h2
|
||||||
{
|
{
|
||||||
margin-top: 1.5em;
|
margin-top: 1.5em;
|
||||||
|
/* border-top: solid #005aa0; */
|
||||||
}
|
}
|
||||||
|
|
||||||
div.section > div.titlepage h2 /* sections */
|
div.sect1 h2 /* sections */
|
||||||
{
|
{
|
||||||
font-size: 150%;
|
font-size: 150%;
|
||||||
margin-top: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 /* subsections */
|
|
||||||
{
|
|
||||||
font-size: 125%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.simplesect h2
|
|
||||||
{
|
|
||||||
font-size: 110%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.appendix h3
|
|
||||||
{
|
|
||||||
font-size: 150%;
|
|
||||||
margin-top: 1.5em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.refnamediv h2, div.refsynopsisdiv h2, div.refsection h2 /* refentry parts */
|
div.refnamediv h2, div.refsynopsisdiv h2, div.refsection h2 /* refentry parts */
|
||||||
{
|
{
|
||||||
margin-top: 1.4em;
|
|
||||||
font-size: 125%;
|
font-size: 125%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,23 +52,30 @@ div.refsection h3
|
|||||||
font-size: 110%;
|
font-size: 110%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h3 /* subsections */
|
||||||
|
{
|
||||||
|
font-size: 125%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
Examples:
|
Program listings:
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
div.example
|
div.example
|
||||||
{
|
{
|
||||||
border: 1px solid #6185a0;
|
border: 1px solid #6185a0;
|
||||||
padding: 6px 6px;
|
padding: 6px 6px;
|
||||||
margin-left: 1.5em;
|
margin-left: 3em;
|
||||||
margin-right: 1.5em;
|
margin-right: 3em;
|
||||||
background: #f4f4f8;
|
background: #eeeeee;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.example p.title
|
pre.programlisting
|
||||||
{
|
{
|
||||||
margin-top: 0em;
|
color: #600000;
|
||||||
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -92,63 +83,41 @@ div.example p.title
|
|||||||
Screen dumps:
|
Screen dumps:
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
pre.screen, pre.programlisting
|
pre.screen
|
||||||
{
|
{
|
||||||
border: 1px solid #6185a0;
|
border: 1px solid #6185a0;
|
||||||
padding: 3px 3px;
|
padding: 6px 6px;
|
||||||
margin-left: 1.5em;
|
margin-left: 3em;
|
||||||
margin-right: 1.5em;
|
margin-right: 3em;
|
||||||
color: #600000;
|
color: #600000;
|
||||||
background: #f4f4f8;
|
background: #eeeeee;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
/* font-size: 90%; */
|
/* font-size: 90%; */
|
||||||
}
|
}
|
||||||
|
|
||||||
div.example pre.programlisting
|
|
||||||
{
|
|
||||||
border: 0px;
|
|
||||||
padding: 0 0;
|
|
||||||
margin: 0 0 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
Notes, warnings etc:
|
Notes, warnings etc:
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
.note, .warning
|
.note,.warning
|
||||||
{
|
{
|
||||||
border: 1px solid #6185a0;
|
margin-top: 1em;
|
||||||
padding: 3px 3px;
|
|
||||||
margin-left: 1.5em;
|
|
||||||
margin-right: 1.5em;
|
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
padding: 0.3em 0.3em 0.3em 0.3em;
|
border: 1px solid #6185a0;
|
||||||
|
padding: 0px 1em;
|
||||||
background: #fffff5;
|
background: #fffff5;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.note, div.warning
|
div.note,div.warning
|
||||||
{
|
{
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.note h3, div.warning h3
|
div.warning h3
|
||||||
{
|
{
|
||||||
color: red;
|
color: red;
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
// margin: 0 0 0 0;
|
|
||||||
padding-right: 0.5em;
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.note p, div.warning p
|
|
||||||
{
|
|
||||||
margin-bottom: 0em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.note h3 + p, div.warning h3 + p
|
|
||||||
{
|
|
||||||
display: inline;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.note h3
|
div.note h3
|
||||||
@@ -198,19 +167,9 @@ tt, code
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.variablelist dd p, div.glosslist dd p
|
div.variablelist dd
|
||||||
{
|
{
|
||||||
margin-top: 0em;
|
margin-bottom: 1em;
|
||||||
}
|
|
||||||
|
|
||||||
div.variablelist dd, div.glosslist dd
|
|
||||||
{
|
|
||||||
margin-left: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.glosslist dt
|
|
||||||
{
|
|
||||||
font-style: italic;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.default
|
.default
|
||||||
@@ -273,16 +232,3 @@ table.productionset table.productionset
|
|||||||
{
|
{
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
strong.command
|
|
||||||
{
|
|
||||||
// font-family: monospace;
|
|
||||||
// font-style: italic;
|
|
||||||
// font-weight: normal;
|
|
||||||
color: #400000;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.calloutlist td
|
|
||||||
{
|
|
||||||
padding-bottom: 1em;
|
|
||||||
}
|
|
||||||
@@ -1,15 +1,35 @@
|
|||||||
<appendix xmlns="http://docbook.org/ns/docbook"
|
<appendix><title>Troubleshooting</title>
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
|
|
||||||
<title>Troubleshooting</title>
|
<para>This section provides solutions for some common problems.</para>
|
||||||
|
|
||||||
|
|
||||||
<para>This section provides solutions for some common problems. See
|
<sect1><title>Berkeley DB: <quote>Cannot allocate memory</quote></title>
|
||||||
the <link xlink:href="http://bugs.strategoxt.org/browse/NIX">Nix
|
|
||||||
bug tracker</link> for a list of currently known issues.</para>
|
<para>Symptom: Nix operations (in particular the
|
||||||
|
<command>nix-store</command> operations <option>--gc</option>,
|
||||||
|
<option>--verify</option>, and <option>--clear-substitutes</option> —
|
||||||
|
the latter being called by <command>nix-channel --update</command>)
|
||||||
|
failing:
|
||||||
|
|
||||||
|
<screen>
|
||||||
|
$ nix-store --verify
|
||||||
|
error: Db::del: Cannot allocate memory</screen>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>Possible solution: make sure that no Nix processes are running,
|
||||||
|
then do:
|
||||||
|
|
||||||
|
<screen>
|
||||||
|
$ cd /nix/var/nix/db
|
||||||
|
$ rm __db.00*</screen>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
<section><title>Collisions in <command>nix-env</command></title>
|
<sect1><title>Collisions in <command>nix-env</command></title>
|
||||||
|
|
||||||
<para>Symptom: when installing or upgrading, you get an error message such as
|
<para>Symptom: when installing or upgrading, you get an error message such as
|
||||||
|
|
||||||
@@ -35,7 +55,7 @@ so it just gives up.</para>
|
|||||||
|
|
||||||
<para>Solution: remove one of the offending packages from the user
|
<para>Solution: remove one of the offending packages from the user
|
||||||
environment (if already installed) using <command>nix-env
|
environment (if already installed) using <command>nix-env
|
||||||
-e</command>, or specify exactly which version should be installed
|
-u</command>, or specify exactly which version should be installed
|
||||||
(e.g., <literal>nix-env -i docbook-xml-4.2</literal>).</para>
|
(e.g., <literal>nix-env -i docbook-xml-4.2</literal>).</para>
|
||||||
|
|
||||||
<para>Alternatively, you can modify the user environment builder
|
<para>Alternatively, you can modify the user environment builder
|
||||||
@@ -45,48 +65,7 @@ to implement some conflict resolution policy. E.g., the script could
|
|||||||
be modified to rename conflicting file names, or to pick one over the
|
be modified to rename conflicting file names, or to pick one over the
|
||||||
other.</para>
|
other.</para>
|
||||||
|
|
||||||
</section>
|
</sect1>
|
||||||
|
|
||||||
|
|
||||||
<section><title><quote>Too many links</quote> error in the Nix
|
|
||||||
store</title>
|
|
||||||
|
|
||||||
|
|
||||||
<para>Symptom: when building something, you get an error message such as
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
...
|
|
||||||
<literal>mkdir: cannot create directory `/nix/store/<replaceable>name</replaceable>': Too many links</literal></screen>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>This is usually because you have more than 32,000 subdirectories
|
|
||||||
in <filename>/nix/store</filename>, as can be seen using <command>ls
|
|
||||||
-l</command>:
|
|
||||||
|
|
||||||
<screen>
|
|
||||||
$ ls -l /nix/store
|
|
||||||
drwxrwxrwt 32000 nix nix 4620288 Sep 8 15:08 store</screen>
|
|
||||||
|
|
||||||
The <literal>ext2</literal> file system is limited to a inode link
|
|
||||||
count of 32,000 (each subdirectory increasing the count by one).
|
|
||||||
Furthermore, the <literal>st_nlink</literal> field of the
|
|
||||||
<function>stat</function> system call is a 16-bit value.</para>
|
|
||||||
|
|
||||||
<para>This only happens on very large Nix installations (such as build
|
|
||||||
machines).</para>
|
|
||||||
|
|
||||||
<para>Quick solution: run the garbage collector. You may want to use
|
|
||||||
the <option>--max-links</option> option.</para>
|
|
||||||
|
|
||||||
<para>Real solution: put the Nix store on a file system that supports
|
|
||||||
more than 32,000 subdirectories per directory, such as ReiserFS.
|
|
||||||
(This doesn’t solve the <literal>st_nlink</literal> limit, but
|
|
||||||
ReiserFS lies to the kernel by reporting a link count of 1 if it
|
|
||||||
exceeds the limit.)</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</appendix>
|
</appendix>
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,24 +0,0 @@
|
|||||||
Generate a private key:
|
|
||||||
|
|
||||||
$ (umask 277 && openssl genrsa -out /nix/etc/nix/signing-key.sec 2048)
|
|
||||||
|
|
||||||
The private key should be kept secret (only readable to the Nix daemon
|
|
||||||
user).
|
|
||||||
|
|
||||||
|
|
||||||
Generate the corresponding public key:
|
|
||||||
|
|
||||||
$ openssl rsa -in /nix/etc/nix/signing-key.sec -pubout > /nix/etc/nix/signing-key.pub
|
|
||||||
|
|
||||||
The public key should be copied to all machines to which you want to
|
|
||||||
export store paths.
|
|
||||||
|
|
||||||
|
|
||||||
Signing:
|
|
||||||
|
|
||||||
$ nix-hash --type sha256 --flat svn.nar | openssl rsautl -sign -inkey mykey.sec > svn.nar.sign
|
|
||||||
|
|
||||||
|
|
||||||
Verifying a signature:
|
|
||||||
|
|
||||||
$ test "$(nix-hash --type sha256 --flat svn.nar)" = "$(openssl rsautl -verify -inkey mykey.pub -pubin -in svn.nar.sign)"
|
|
||||||
Vendored
+50
-45
@@ -1,67 +1,72 @@
|
|||||||
# bzip2
|
# Berkeley DB
|
||||||
|
|
||||||
BZIP2 = bzip2-1.0.5
|
DB = db-4.2.52
|
||||||
|
|
||||||
$(BZIP2).tar.gz:
|
$(DB).tar.gz:
|
||||||
@echo "Nix requires bzip2 to build."
|
@echo "Nix requires Berkeley DB to build."
|
||||||
@echo "Please download version 1.0.5 from"
|
@echo "Please download version 4.2.52 from"
|
||||||
@echo " http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz"
|
@echo " http://www.sleepycat.com/update/snapshot/db-4.2.52.tar.gz"
|
||||||
@echo "and place it in the externals/ directory."
|
@echo "and place it in the externals/ directory."
|
||||||
false
|
false
|
||||||
|
|
||||||
$(BZIP2): $(BZIP2).tar.gz
|
$(DB): $(DB).tar.gz
|
||||||
gunzip < $(srcdir)/$(BZIP2).tar.gz | tar xvf -
|
gunzip < $(DB).tar.gz | tar xvf -
|
||||||
|
|
||||||
if HAVE_BZIP2
|
have-db:
|
||||||
build-bzip2:
|
$(MAKE) $(DB)
|
||||||
|
touch have-db
|
||||||
|
|
||||||
|
if HAVE_BDB
|
||||||
|
build-db:
|
||||||
else
|
else
|
||||||
build-bzip2: $(BZIP2)
|
build-db: have-db
|
||||||
(cd $(BZIP2) && \
|
(pfx=`pwd` && \
|
||||||
$(MAKE) CC="$(CC)" && \
|
cd $(DB)/build_unix && \
|
||||||
$(MAKE) install PREFIX=$(abs_builddir)/inst-bzip2)
|
CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
|
||||||
touch build-bzip2
|
../dist/configure --prefix=$$pfx/inst-bdb \
|
||||||
|
--enable-cxx --disable-shared --disable-cryptography \
|
||||||
install-exec-local:: build-bzip2
|
--disable-replication --disable-verify && \
|
||||||
mkdir -p $(DESTDIR)${bzip2_bin}
|
make && \
|
||||||
$(INSTALL_PROGRAM) $(bzip2_bin_test)/bzip2 $(bzip2_bin_test)/bunzip2 $(DESTDIR)${bzip2_bin}
|
make install)
|
||||||
|
touch build-db
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
# SQLite
|
# CWI ATerm
|
||||||
|
|
||||||
SQLITE = sqlite-autoconf-$(SQLITE_VERSION)
|
ATERM = aterm-2.3.1
|
||||||
SQLITE_TAR = sqlite-autoconf-$(SQLITE_VERSION).tar.gz
|
|
||||||
|
|
||||||
$(SQLITE_TAR):
|
$(ATERM).tar.gz:
|
||||||
@echo "Nix requires the SQLite library to build."
|
@echo "Nix requires the CWI ATerm library to build."
|
||||||
@echo "Please download version $(SQLITE_VERSION) from"
|
@echo "Please download version 2.3.1 from"
|
||||||
@echo " http://www.sqlite.org/$(SQLITE_TAR)"
|
@echo " http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.3.1.tar.gz"
|
||||||
@echo "and place it in the externals/ directory."
|
@echo "and place it in the externals/ directory."
|
||||||
false
|
false
|
||||||
|
|
||||||
$(SQLITE): $(SQLITE_TAR)
|
$(ATERM): $(ATERM).tar.gz
|
||||||
gzip -d < $(srcdir)/$(SQLITE_TAR) | tar xvf -
|
gunzip < $(ATERM).tar.gz | tar xvf -
|
||||||
|
|
||||||
if HAVE_SQLITE
|
have-aterm:
|
||||||
build-sqlite:
|
$(MAKE) $(ATERM)
|
||||||
|
touch have-aterm
|
||||||
|
|
||||||
|
if HAVE_ATERM
|
||||||
|
build-aterm:
|
||||||
else
|
else
|
||||||
build-sqlite: $(SQLITE)
|
build-aterm: have-aterm
|
||||||
(cd $(SQLITE) && \
|
(pfx=`pwd` && \
|
||||||
CC="$(CC)" CFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA=1" ./configure --disable-static --prefix=$(pkglibdir)/dummy --libdir=${pkglibdir} $(SUB_CONFIGURE_FLAGS) && \
|
cd $(ATERM) && \
|
||||||
$(MAKE) )
|
CC="$(CC)" ./configure --prefix=$$pfx/inst-aterm && \
|
||||||
touch build-sqlite
|
make && \
|
||||||
|
make install)
|
||||||
install-exec-local:: build-sqlite
|
touch build-aterm
|
||||||
cd $(SQLITE) && $(MAKE) install
|
|
||||||
rm -rf "$(DESTDIR)/$(pkglibdir)/dummy"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
all: build-bzip2 build-sqlite
|
all: build-db build-aterm
|
||||||
|
|
||||||
EXTRA_DIST = $(BZIP2).tar.gz $(SQLITE_TAR)
|
EXTRA_DIST = $(DB).tar.gz $(ATERM).tar.gz
|
||||||
|
|
||||||
clean:
|
ext-clean:
|
||||||
$(RM) -f build-bzip2 build-sqlite
|
$(RM) -f have-db build-db have-aterm build-aterm
|
||||||
$(RM) -rf $(BZIP2) $(SQLITE)
|
$(RM) -rf $(DB) $(ATERM)
|
||||||
$(RM) -rf inst-bzip2
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
{sharedLib ? true}:
|
|
||||||
|
|
||||||
rec {
|
|
||||||
|
|
||||||
inherit (import ../../../lib) compileC makeLibrary;
|
|
||||||
|
|
||||||
sources = [
|
|
||||||
./afun.c
|
|
||||||
./aterm.c
|
|
||||||
./bafio.c
|
|
||||||
./byteio.c
|
|
||||||
./gc.c
|
|
||||||
./hash.c
|
|
||||||
./list.c
|
|
||||||
./make.c
|
|
||||||
./md5c.c
|
|
||||||
./memory.c
|
|
||||||
./tafio.c
|
|
||||||
./version.c
|
|
||||||
];
|
|
||||||
|
|
||||||
compile = main: compileC {inherit main sharedLib;};
|
|
||||||
|
|
||||||
libATerm = makeLibrary {
|
|
||||||
libraryName = "ATerm";
|
|
||||||
objects = map compile sources;
|
|
||||||
inherit sharedLib;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
import test/default.nix
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
with (import ../../../lib);
|
|
||||||
|
|
||||||
let {
|
|
||||||
inherit (import ../aterm {}) libATerm;
|
|
||||||
|
|
||||||
compileTest = main: link {
|
|
||||||
objects = [(compileC {inherit main; localIncludePath = [ ../aterm ];})];
|
|
||||||
libraries = libATerm;
|
|
||||||
};
|
|
||||||
|
|
||||||
body = [
|
|
||||||
(compileTest ./fib.c)
|
|
||||||
(compileTest ./primes.c)
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
[ (import ./trivial)
|
|
||||||
(import ./simple-header)
|
|
||||||
(import ./not-so-simple-header)
|
|
||||||
(import ./not-so-simple-header-auto)
|
|
||||||
(import ./aterm)
|
|
||||||
]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
#define WHAT "World"
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
with import ../../lib;
|
|
||||||
|
|
||||||
let {
|
|
||||||
|
|
||||||
hello = link {programName = "hello"; objects = compileC {
|
|
||||||
main = ./foo/hello.c;
|
|
||||||
localIncludes = "auto";
|
|
||||||
};};
|
|
||||||
|
|
||||||
# body = findIncludes {main = ./foo/hello.c;};
|
|
||||||
|
|
||||||
body = [hello];
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#define HELLO "Hello"
|
|
||||||
|
|
||||||
#include "../../bar/hello.h"
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "fnord/indirect.h"
|
|
||||||
|
|
||||||
int main(int argc, char * * argv)
|
|
||||||
{
|
|
||||||
printf(HELLO " " WHAT "\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
#define WHAT "World"
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
let {
|
|
||||||
|
|
||||||
inherit (import ../../lib) compileC link;
|
|
||||||
|
|
||||||
hello = link {programName = "hello"; objects = compileC {
|
|
||||||
main = ./foo/hello.c;
|
|
||||||
localIncludes = [
|
|
||||||
[./foo/fnord/indirect.h "fnord/indirect.h"]
|
|
||||||
[./bar/hello.h "fnord/../../bar/hello.h"]
|
|
||||||
];
|
|
||||||
};};
|
|
||||||
|
|
||||||
body = [hello];
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#define HELLO "Hello"
|
|
||||||
|
|
||||||
#include "../../bar/hello.h"
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "fnord/indirect.h"
|
|
||||||
|
|
||||||
int main(int argc, char * * argv)
|
|
||||||
{
|
|
||||||
printf(HELLO " " WHAT "\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
let {
|
|
||||||
|
|
||||||
inherit (import ../../lib) compileC link;
|
|
||||||
|
|
||||||
hello = link {objects = compileC {
|
|
||||||
main = ./hello.c;
|
|
||||||
localIncludes = [ [./hello.h "hello.h"] ];
|
|
||||||
};};
|
|
||||||
|
|
||||||
body = [hello];
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "hello.h"
|
|
||||||
|
|
||||||
int main(int argc, char * * argv)
|
|
||||||
{
|
|
||||||
printf("Hello " WHAT "\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
#define WHAT "World"
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
let {
|
|
||||||
|
|
||||||
inherit (import ../../lib) compileC link;
|
|
||||||
|
|
||||||
hello = link {objects = compileC {main = ./hello.c;};};
|
|
||||||
|
|
||||||
body = [hello];
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(int argc, char * * argv)
|
|
||||||
{
|
|
||||||
printf("Hello World\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
. $stdenv/setup
|
|
||||||
|
|
||||||
mainName=$(basename $main | cut -c34-)
|
|
||||||
|
|
||||||
echo "compiling \`$mainName'..."
|
|
||||||
|
|
||||||
# Turn $localIncludes into an array.
|
|
||||||
localIncludes=($localIncludes)
|
|
||||||
|
|
||||||
# Determine how many `..' levels appear in the header file references.
|
|
||||||
# E.g., if there is some reference `../../foo.h', then we have to
|
|
||||||
# insert two extra levels in the directory structure, so that `a.c' is
|
|
||||||
# stored at `dotdot/dotdot/a.c', and a reference from it to
|
|
||||||
# `../../foo.h' resolves to `dotdot/dotdot/../../foo.h' == `foo.h'.
|
|
||||||
n=0
|
|
||||||
maxDepth=0
|
|
||||||
for ((n = 0; n < ${#localIncludes[*]}; n += 2)); do
|
|
||||||
target=${localIncludes[$((n + 1))]}
|
|
||||||
|
|
||||||
# Split the target name into path components using some IFS magic.
|
|
||||||
savedIFS="$IFS"
|
|
||||||
IFS=/
|
|
||||||
components=($target)
|
|
||||||
depth=0
|
|
||||||
for ((m = 0; m < ${#components[*]}; m++)); do
|
|
||||||
c=${components[m]}
|
|
||||||
if test "$c" = ".."; then
|
|
||||||
depth=$((depth + 1))
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS="$savedIFS"
|
|
||||||
|
|
||||||
if test $depth -gt $maxDepth; then
|
|
||||||
maxDepth=$depth;
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Create the extra levels in the directory hierarchy.
|
|
||||||
prefix=
|
|
||||||
for ((n = 0; n < maxDepth; n++)); do
|
|
||||||
prefix="dotdot/$prefix"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Create symlinks to the header files.
|
|
||||||
for ((n = 0; n < ${#localIncludes[*]}; n += 2)); do
|
|
||||||
source=${localIncludes[n]}
|
|
||||||
target=${localIncludes[$((n + 1))]}
|
|
||||||
|
|
||||||
# Create missing directories. We use IFS magic to split the path
|
|
||||||
# into path components.
|
|
||||||
savedIFS="$IFS"
|
|
||||||
IFS=/
|
|
||||||
components=($prefix$target)
|
|
||||||
fullPath=(.)
|
|
||||||
for ((m = 0; m < ${#components[*]} - 1; m++)); do
|
|
||||||
fullPath=("${fullPath[@]}" ${components[m]})
|
|
||||||
if ! test -d "${fullPath[*]}"; then
|
|
||||||
mkdir "${fullPath[*]}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS="$savedIFS"
|
|
||||||
|
|
||||||
ln -sf $source $prefix$target
|
|
||||||
done
|
|
||||||
|
|
||||||
# Create a symlink to the main file.
|
|
||||||
if ! test "$(readlink $prefix$mainName)" = $main; then
|
|
||||||
ln -s $main $prefix$mainName
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir $out
|
|
||||||
test "$prefix" && cd $prefix
|
|
||||||
gcc -Wall $cFlags -c $mainName -o $out/$mainName.o
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
rec {
|
|
||||||
|
|
||||||
# Should point at your Nixpkgs installation.
|
|
||||||
pkgPath = ./pkgs;
|
|
||||||
|
|
||||||
pkgs = import (pkgPath + /system/all-packages.nix) {};
|
|
||||||
|
|
||||||
stdenv = pkgs.stdenv;
|
|
||||||
|
|
||||||
|
|
||||||
compileC =
|
|
||||||
{ main
|
|
||||||
, localIncludes ? "auto"
|
|
||||||
, localIncludePath ? []
|
|
||||||
, cFlags ? ""
|
|
||||||
, sharedLib ? false
|
|
||||||
}:
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "compile-c";
|
|
||||||
builder = ./compile-c.sh;
|
|
||||||
|
|
||||||
localIncludes =
|
|
||||||
if localIncludes == "auto" then
|
|
||||||
dependencyClosure {
|
|
||||||
scanner = main:
|
|
||||||
import (findIncludes {
|
|
||||||
inherit main;
|
|
||||||
});
|
|
||||||
searchPath = localIncludePath;
|
|
||||||
startSet = [main];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
localIncludes;
|
|
||||||
|
|
||||||
inherit main;
|
|
||||||
|
|
||||||
cFlags = [
|
|
||||||
cFlags
|
|
||||||
(if sharedLib then ["-fpic"] else [])
|
|
||||||
(map (p: "-I" + (relativise (dirOf main) p)) localIncludePath)
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
findIncludes = {main}: stdenv.mkDerivation {
|
|
||||||
name = "find-includes";
|
|
||||||
realBuilder = pkgs.perl ~ "bin/perl";
|
|
||||||
args = [ ./find-includes.pl ];
|
|
||||||
inherit main;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
link = {objects, programName ? "program", libraries ? []}: stdenv.mkDerivation {
|
|
||||||
name = "link";
|
|
||||||
builder = ./link.sh;
|
|
||||||
inherit objects programName libraries;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
makeLibrary = {objects, libraryName ? [], sharedLib ? false}:
|
|
||||||
# assert sharedLib -> fold (obj: x: assert obj.sharedLib && x) false objects
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "library";
|
|
||||||
builder = ./make-library.sh;
|
|
||||||
inherit objects libraryName sharedLib;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
use strict;
|
|
||||||
|
|
||||||
my $root = $ENV{"main"};
|
|
||||||
my $out = $ENV{"out"};
|
|
||||||
|
|
||||||
open OUT, ">$out" or die "$!";
|
|
||||||
print OUT "[\n";
|
|
||||||
|
|
||||||
open IN, "<$root" or die "$!";
|
|
||||||
while (<IN>) {
|
|
||||||
if (/^\#include\s+\"(.*)\"/) {
|
|
||||||
print OUT "\"$1\"\n";
|
|
||||||
}
|
|
||||||
if (/^\#include\s+\<(.*)\>/) {
|
|
||||||
print OUT "\"$1\"\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close IN;
|
|
||||||
|
|
||||||
print OUT "]\n";
|
|
||||||
close OUT;
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
. $stdenv/setup
|
|
||||||
|
|
||||||
shopt -s nullglob
|
|
||||||
|
|
||||||
objs=
|
|
||||||
for i in $objects; do
|
|
||||||
obj=$(echo $i/*.o)
|
|
||||||
objs="$objs $obj"
|
|
||||||
done
|
|
||||||
|
|
||||||
libs=
|
|
||||||
for i in $libraries; do
|
|
||||||
lib=$(echo $i/*.a; echo $i/*.so)
|
|
||||||
name=$(echo $(basename $lib) | sed -e 's/^lib//' -e 's/.a$//' -e 's/.so$//')
|
|
||||||
libs="$libs -L$(dirname $lib) -l$name"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "linking object files into \`$programName'..."
|
|
||||||
|
|
||||||
mkdir $out
|
|
||||||
gcc -o $out/$programName $objs $libs
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
. $stdenv/setup
|
|
||||||
|
|
||||||
objs=
|
|
||||||
for i in $objects; do
|
|
||||||
obj=$(echo $i/*.o)
|
|
||||||
objs="$objs $obj"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "archiving object files into library \`$libraryName'..."
|
|
||||||
|
|
||||||
ensureDir $out
|
|
||||||
|
|
||||||
if test -z "$sharedLib"; then
|
|
||||||
|
|
||||||
outPath=$out/lib${libraryName}.a
|
|
||||||
|
|
||||||
ar crs $outPath $objs
|
|
||||||
ranlib $outPath
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
outPath=$out/lib${libraryName}.so
|
|
||||||
|
|
||||||
gcc -shared -o $outPath $objs
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2,4 +2,4 @@ EXTRA_DIST = nix-mode.el
|
|||||||
|
|
||||||
install-data-local:
|
install-data-local:
|
||||||
$(INSTALL) -d $(DESTDIR)$(datadir)/emacs/site-lisp
|
$(INSTALL) -d $(DESTDIR)$(datadir)/emacs/site-lisp
|
||||||
$(INSTALL_DATA) $(srcdir)/nix-mode.el $(DESTDIR)$(datadir)/emacs/site-lisp
|
$(INSTALL_DATA) nix-mode.el $(DESTDIR)$(datadir)/emacs/site-lisp
|
||||||
@@ -66,8 +66,8 @@ The hook `nix-mode-hook' is run when Nix mode is started.
|
|||||||
|
|
||||||
|
|
||||||
(defvar nix-keywords
|
(defvar nix-keywords
|
||||||
'("\\<if\\>" "\\<then\\>" "\\<else\\>" "\\<assert\\>" "\\<with\\>"
|
'("\\<if\\>" "\\<then\\>" "\\<else\\>" "\\<assert\\>"
|
||||||
"\\<let\\>" "\\<in\\>" "\\<rec\\>" "\\<inherit\\>"
|
"\\<let\\>" "\\<rec\\>" "\\<inherit\\>"
|
||||||
("\\<true\\>" . font-lock-builtin-face)
|
("\\<true\\>" . font-lock-builtin-face)
|
||||||
("\\<false\\>" . font-lock-builtin-face)
|
("\\<false\\>" . font-lock-builtin-face)
|
||||||
("\\<null\\>" . font-lock-builtin-face)
|
("\\<null\\>" . font-lock-builtin-face)
|
||||||
@@ -76,10 +76,10 @@ The hook `nix-mode-hook' is run when Nix mode is started.
|
|||||||
("\\<baseNameOf\\>" . font-lock-builtin-face)
|
("\\<baseNameOf\\>" . font-lock-builtin-face)
|
||||||
("\\<toString\\>" . font-lock-builtin-face)
|
("\\<toString\\>" . font-lock-builtin-face)
|
||||||
("\\<isNull\\>" . font-lock-builtin-face)
|
("\\<isNull\\>" . font-lock-builtin-face)
|
||||||
|
("\\<\\([a-zA-Z_][a-zA-Z0-9_']*\\)[ \t]*="
|
||||||
|
(1 font-lock-variable-name-face nil nil))
|
||||||
("[a-zA-Z][a-zA-Z0-9\\+-\\.]*:[a-zA-Z0-9%/\\?:@&=\\+\\$,_\\.!~\\*'-]+"
|
("[a-zA-Z][a-zA-Z0-9\\+-\\.]*:[a-zA-Z0-9%/\\?:@&=\\+\\$,_\\.!~\\*'-]+"
|
||||||
. font-lock-constant-face)
|
. font-lock-constant-face)
|
||||||
("\\<\\([a-zA-Z_][a-zA-Z0-9_'\.]*\\)[ \t]*="
|
|
||||||
(1 font-lock-variable-name-face nil nil))
|
|
||||||
("[a-zA-Z0-9._\\+-]*\\(/[a-zA-Z0-9._\\+-]+\\)+"
|
("[a-zA-Z0-9._\\+-]*\\(/[a-zA-Z0-9._\\+-]+\\)+"
|
||||||
. font-lock-constant-face)
|
. font-lock-constant-face)
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
" Vim syntax file
|
|
||||||
" Language: nix
|
|
||||||
" Maintainer: Marc Weber <marco-oweber@gmx.de>
|
|
||||||
" Modify and commit if you feel that way
|
|
||||||
" Last Change: 2007 Dec
|
|
||||||
|
|
||||||
" Quit when a (custom) syntax file was already loaded
|
|
||||||
if exists("b:current_syntax")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
syn keyword nixKeyword let throw inherit import true false null with
|
|
||||||
syn keyword nixConditional if else then
|
|
||||||
syn keyword nixBrace ( ) { } =
|
|
||||||
syn keyword nixBuiltin __currentSystem __currentTime __isFunction __getEnv __trace __toPath __pathExists
|
|
||||||
\ __readFile __toXML __toFile __filterSource __attrNames __getAttr __hasAttr __isAttrs __listToAttrs __isList
|
|
||||||
\ __head __tail __add __sub __lessThan __substring __stringLength
|
|
||||||
|
|
||||||
syn match nixAttr "\w\+\ze\s*="
|
|
||||||
syn match nixFuncArg "\zs\w\+\ze\s*:"
|
|
||||||
syn region nixStringParam start=+\${+ end=+}+
|
|
||||||
syn region nixMultiLineComment start=+/\*+ skip=+\\"+ end=+\*/+
|
|
||||||
syn match nixEndOfLineComment "#.*$"
|
|
||||||
syn region nixStringIndented start=+''+ skip=+'''\|''${\|"+ end=+''+ contains=nixStringParam
|
|
||||||
syn region nixString start=+"+ skip=+\\"+ end=+"+ contains=nixStringParam
|
|
||||||
|
|
||||||
hi def link nixKeyword Keyword
|
|
||||||
hi def link nixConditional Conditional
|
|
||||||
hi def link nixBrace Special
|
|
||||||
hi def link nixString String
|
|
||||||
hi def link nixStringIndented String
|
|
||||||
hi def link nixBuiltin Special
|
|
||||||
hi def link nixStringParam Macro
|
|
||||||
hi def link nixMultiLineComment Comment
|
|
||||||
hi def link nixEndOfLineComment Comment
|
|
||||||
hi def link nixAttr Identifier
|
|
||||||
hi def link nixFuncArg Identifier
|
|
||||||
+3
-135
@@ -11,7 +11,7 @@
|
|||||||
# build time (e.g., the C compiler, or source tarballs downloaded from
|
# build time (e.g., the C compiler, or source tarballs downloaded from
|
||||||
# the network). To prevent it from doing so, set this option to
|
# the network). To prevent it from doing so, set this option to
|
||||||
# `true'.
|
# `true'.
|
||||||
#gc-keep-outputs = false
|
gc-keep-outputs = false
|
||||||
|
|
||||||
|
|
||||||
### Option `gc-keep-derivations'
|
### Option `gc-keep-derivations'
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
# store path was built), so by default this option is on. Turn it off
|
# store path was built), so by default this option is on. Turn it off
|
||||||
# to safe a bit of disk space (or a lot if `gc-keep-outputs' is also
|
# to safe a bit of disk space (or a lot if `gc-keep-outputs' is also
|
||||||
# turned on).
|
# turned on).
|
||||||
#gc-keep-derivations = true
|
gc-keep-derivations = true
|
||||||
|
|
||||||
|
|
||||||
### Option `env-keep-derivations'
|
### Option `env-keep-derivations'
|
||||||
@@ -46,136 +46,4 @@
|
|||||||
# this one is `sticky': it applies to any user environment created
|
# this one is `sticky': it applies to any user environment created
|
||||||
# while this option was enabled, while `gc-keep-derivations' only
|
# while this option was enabled, while `gc-keep-derivations' only
|
||||||
# applies at the moment the garbage collector is run.
|
# applies at the moment the garbage collector is run.
|
||||||
#env-keep-derivations = false
|
env-keep-derivations = false
|
||||||
|
|
||||||
|
|
||||||
### Option `build-max-jobs'
|
|
||||||
#
|
|
||||||
# This option defines the maximum number of jobs that Nix will try to
|
|
||||||
# build in parallel. The default is 1. You should generally set it
|
|
||||||
# to the number of CPUs in your system (e.g., 2 on a Athlon 64 X2).
|
|
||||||
# It can be overriden using the `--max-jobs' / `-j' command line
|
|
||||||
# switch.
|
|
||||||
#build-max-jobs = 1
|
|
||||||
|
|
||||||
|
|
||||||
### Option `build-cores'
|
|
||||||
#
|
|
||||||
# This option defines the number of CPU cores to utilize in parallel
|
|
||||||
# within a build job, i.e. by passing an appropriate `-jN' flag to GNU
|
|
||||||
# Make. The default is 1, meaning that parallel building within jobs
|
|
||||||
# is disabled. Passing the special value `0' causes Nix to try and
|
|
||||||
# auto-detect the number of available cores on the local host. This
|
|
||||||
# setting can be overridden using the `--cores' command line switch.
|
|
||||||
#build-cores = 1
|
|
||||||
|
|
||||||
|
|
||||||
### Option `build-max-silent-time'
|
|
||||||
#
|
|
||||||
# This option defines the maximum number of seconds that a builder can
|
|
||||||
# go without producing any data on standard output or standard error.
|
|
||||||
# This is useful (for instance in a automated build system) to catch
|
|
||||||
# builds that are stuck in an infinite loop, or to catch remote builds
|
|
||||||
# that are hanging due to network problems. It can be overriden using
|
|
||||||
# the `--max-silent-time' command line switch.
|
|
||||||
#
|
|
||||||
# The value 0 means that there is no timeout. This is also the
|
|
||||||
# default.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# build-max-silent-time = 600 # = 10 minutes
|
|
||||||
#build-max-silent-time = 0
|
|
||||||
|
|
||||||
|
|
||||||
### Option `build-users-group'
|
|
||||||
#
|
|
||||||
# This options specifies the Unix group containing the Nix build user
|
|
||||||
# accounts. In multi-user Nix installations, builds should not
|
|
||||||
# be performed by the Nix account since that would allow users to
|
|
||||||
# arbitrarily modify the Nix store and database by supplying specially
|
|
||||||
# crafted builders; and they cannot be performed by the calling user
|
|
||||||
# since that would allow him/her to influence the build result.
|
|
||||||
#
|
|
||||||
# Therefore, if this option is non-empty and specifies a valid group,
|
|
||||||
# builds will be performed under the user accounts that are a member
|
|
||||||
# of the group specified here (as listed in /etc/group). Those user
|
|
||||||
# accounts should not be used for any other purpose!
|
|
||||||
#
|
|
||||||
# Nix will never run two builds under the same user account at the
|
|
||||||
# same time. This is to prevent an obvious security hole: a malicious
|
|
||||||
# user writing a Nix expression that modifies the build result of a
|
|
||||||
# legitimate Nix expression being built by another user. Therefore it
|
|
||||||
# is good to have as many Nix build user accounts as you can spare.
|
|
||||||
# (Remember: uids are cheap.)
|
|
||||||
#
|
|
||||||
# The build users should have permission to create files in the Nix
|
|
||||||
# store, but not delete them. Therefore, /nix/store should be owned
|
|
||||||
# by the Nix account, its group should be the group specified here,
|
|
||||||
# and its mode should be 1775.
|
|
||||||
#
|
|
||||||
# If the build users group is empty, builds will be performed under
|
|
||||||
# the uid of the Nix process (that is, the uid of the caller if
|
|
||||||
# $NIX_REMOTE is empty, the uid under which the Nix daemon runs if
|
|
||||||
# $NIX_REMOTE is `daemon', or the uid that owns the setuid nix-worker
|
|
||||||
# program if $NIX_REMOTE is `slave'). Obviously, this should not be
|
|
||||||
# used in multi-user settings with untrusted users.
|
|
||||||
#
|
|
||||||
# The default is empty.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# build-users-group = nix-builders
|
|
||||||
#build-users-group =
|
|
||||||
|
|
||||||
|
|
||||||
### Option `build-use-chroot'
|
|
||||||
#
|
|
||||||
# If set to `true', builds will be performed in a chroot environment,
|
|
||||||
# i.e., the build will be isolated from the normal file system
|
|
||||||
# hierarchy and will only see the Nix store, the temporary build
|
|
||||||
# directory, and the directories configured with the
|
|
||||||
# `build-chroot-dirs' option (such as /proc and /dev). This is useful
|
|
||||||
# to prevent undeclared dependencies on files in directories such as
|
|
||||||
# /usr/bin.
|
|
||||||
#
|
|
||||||
# The use of a chroot requires that Nix is run as root (but you can
|
|
||||||
# still use the "build users" feature to perform builds under
|
|
||||||
# different users than root). Currently, chroot builds only work on
|
|
||||||
# Linux because Nix uses "bind mounts" to make the Nix store and other
|
|
||||||
# directories available inside the chroot.
|
|
||||||
#
|
|
||||||
# The default is `false'.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# build-use-chroot = true
|
|
||||||
#build-use-chroot = false
|
|
||||||
|
|
||||||
|
|
||||||
### Option `build-chroot-dirs'
|
|
||||||
#
|
|
||||||
# When builds are performed in a chroot environment, Nix will mount
|
|
||||||
# (using `mount --bind' on Linux) some directories from the normal
|
|
||||||
# file system hierarchy inside the chroot. These are the Nix store,
|
|
||||||
# the temporary build directory (usually /tmp/nix-<pid>-<number>) and
|
|
||||||
# the directories listed here. The default is "/dev /dev/pts /proc".
|
|
||||||
# Files in /dev (such as /dev/null) are needed by many builds, and
|
|
||||||
# some files in /proc may also be needed occasionally.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# build-use-chroot = /dev /proc /bin
|
|
||||||
#build-chroot-dirs = /dev /dev/pts /proc
|
|
||||||
|
|
||||||
|
|
||||||
### Option `build-cache-failure'
|
|
||||||
#
|
|
||||||
# If this option is enabled, Nix will do negative caching; that is, it
|
|
||||||
# will remember failed builds, and won't attempt to try to build them
|
|
||||||
# again if you ask for it. Negative caching is disabled by default
|
|
||||||
# because Nix cannot distinguish between permanent build errors (e.g.,
|
|
||||||
# a syntax error in a source file) and transient build errors (e.g., a
|
|
||||||
# full disk), as they both cause the builder to return a non-zero exit
|
|
||||||
# code. You can clear the cache by doing `rm -f
|
|
||||||
# /nix/var/nix/db/failed/*'.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# build-cache-failure = true
|
|
||||||
#build-cache-failure = false
|
|
||||||
+12
-18
@@ -13,24 +13,19 @@ Version: @version@
|
|||||||
Release: 1
|
Release: 1
|
||||||
License: GPL
|
License: GPL
|
||||||
Group: Software Deployment
|
Group: Software Deployment
|
||||||
URL: http://nixos.org/
|
URL: http://www.cs.uu.nl/groups/ST/Trace/Nix
|
||||||
Source0: %{name}-@version@.tar.bz2
|
Source0: %{name}-@version@.tar.gz
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||||
Prefix: /usr
|
%define _prefix /nix
|
||||||
|
Prefix: %{_prefix}
|
||||||
Requires: /usr/bin/perl
|
Requires: /usr/bin/perl
|
||||||
Requires: curl
|
|
||||||
|
|
||||||
# Hack to make that shitty RPM scanning hack shut up.
|
# Hack to make that shitty RPM scanning hack shut up.
|
||||||
Provides: perl(readmanifest)
|
Provides: perl(readmanifest)
|
||||||
|
|
||||||
%description
|
%description
|
||||||
|
|
||||||
Nix is a purely functional package manager. It allows multiple
|
Nix is a system for software deployment.
|
||||||
versions of a package to be installed side-by-side, ensures that
|
|
||||||
dependency specifications are complete, supports atomic upgrades and
|
|
||||||
rollbacks, allows non-root users to install software, and has many
|
|
||||||
other features. It is the basis of the NixOS Linux distribution, but
|
|
||||||
it can be used equally well under other Unix systems.
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
@@ -46,14 +41,13 @@ if test -n "%{enable_setuid}"; then
|
|||||||
extraFlags="$extraFlags --with-nix-group=%{nix_group}"
|
extraFlags="$extraFlags --with-nix-group=%{nix_group}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
./configure --prefix=%{_prefix} --sysconfdir=/etc $extraFlags
|
./configure --prefix=%{_prefix} $extraFlags
|
||||||
make
|
make
|
||||||
make check
|
make check
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
make DESTDIR=$RPM_BUILD_ROOT install
|
make DESTDIR=$RPM_BUILD_ROOT install
|
||||||
rm $RPM_BUILD_ROOT/etc/nix/nix.conf
|
|
||||||
strip $RPM_BUILD_ROOT/%{_prefix}/bin/* || true
|
strip $RPM_BUILD_ROOT/%{_prefix}/bin/* || true
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
@@ -72,12 +66,12 @@ fi
|
|||||||
%files
|
%files
|
||||||
#%defattr(-,root,root)
|
#%defattr(-,root,root)
|
||||||
%{_prefix}/bin
|
%{_prefix}/bin
|
||||||
%{_prefix}/lib
|
|
||||||
%{_prefix}/libexec
|
%{_prefix}/libexec
|
||||||
%{_prefix}/include
|
%{_prefix}/var
|
||||||
%{_prefix}/share
|
%{_prefix}/share
|
||||||
/etc/profile.d/nix.sh
|
%{_prefix}/man
|
||||||
/nix/var
|
%{_prefix}/store
|
||||||
/nix/store
|
|
||||||
%config
|
%config
|
||||||
/etc/nix
|
%{_prefix}/etc
|
||||||
|
#%doc
|
||||||
|
#%{_prefix}/share/nix/manual
|
||||||
-177
@@ -1,177 +0,0 @@
|
|||||||
{ nixpkgs ? ../nixpkgs
|
|
||||||
, nix ? { outPath = ./.; rev = 1234; }
|
|
||||||
, officialRelease ? false
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
jobs = rec {
|
|
||||||
|
|
||||||
|
|
||||||
tarball =
|
|
||||||
with import nixpkgs {};
|
|
||||||
|
|
||||||
releaseTools.sourceTarball {
|
|
||||||
name = "nix-tarball";
|
|
||||||
version = builtins.readFile ./version;
|
|
||||||
src = nix;
|
|
||||||
inherit officialRelease;
|
|
||||||
|
|
||||||
buildInputs =
|
|
||||||
[ curl bison24 flex2535 perl libxml2 libxslt w3m bzip2
|
|
||||||
tetex dblatex nukeReferences pkgconfig
|
|
||||||
];
|
|
||||||
|
|
||||||
configureFlags = ''
|
|
||||||
--with-docbook-rng=${docbook5}/xml/rng/docbook
|
|
||||||
--with-docbook-xsl=${docbook5_xsl}/xml/xsl/docbook
|
|
||||||
--with-xml-flags=--nonet
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Include the Bzip2 tarball in the distribution.
|
|
||||||
preConfigure = ''
|
|
||||||
stripHash ${bzip2.src}
|
|
||||||
cp -pv ${bzip2.src} externals/$strippedName
|
|
||||||
|
|
||||||
stripHash ${sqlite.src}
|
|
||||||
cp -pv ${sqlite.src} externals/$strippedName
|
|
||||||
|
|
||||||
# TeX needs a writable font cache.
|
|
||||||
export VARTEXFONTS=$TMPDIR/texfonts
|
|
||||||
'';
|
|
||||||
|
|
||||||
preDist = ''
|
|
||||||
make -C doc/manual install prefix=$out
|
|
||||||
|
|
||||||
make -C doc/manual manual.pdf prefix=$out
|
|
||||||
cp doc/manual/manual.pdf $out/manual.pdf
|
|
||||||
|
|
||||||
# The PDF containes filenames of included graphics (see
|
|
||||||
# http://www.tug.org/pipermail/pdftex/2007-August/007290.html).
|
|
||||||
# This causes a retained dependency on dblatex, which Hydra
|
|
||||||
# doesn't like (the output of the tarball job is distributed
|
|
||||||
# to Windows and Macs, so there should be no Linux binaries
|
|
||||||
# in the closure).
|
|
||||||
nuke-refs $out/manual.pdf
|
|
||||||
|
|
||||||
echo "doc manual $out/share/doc/nix/manual" >> $out/nix-support/hydra-build-products
|
|
||||||
echo "doc-pdf manual $out/manual.pdf" >> $out/nix-support/hydra-build-products
|
|
||||||
echo "doc release-notes $out/share/doc/nix/release-notes" >> $out/nix-support/hydra-build-products
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
build =
|
|
||||||
{ system ? "i686-linux" }:
|
|
||||||
|
|
||||||
with import nixpkgs { inherit system; };
|
|
||||||
|
|
||||||
releaseTools.nixBuild {
|
|
||||||
name = "nix";
|
|
||||||
src = tarball;
|
|
||||||
|
|
||||||
buildInputs = [ curl perl bzip2 openssl pkgconfig boehmgc ];
|
|
||||||
|
|
||||||
configureFlags = ''
|
|
||||||
--disable-init-state
|
|
||||||
--with-bzip2=${bzip2} --with-sqlite=${sqlite}
|
|
||||||
--enable-gc
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
coverage =
|
|
||||||
with import nixpkgs { system = "x86_64-linux"; };
|
|
||||||
|
|
||||||
releaseTools.coverageAnalysis {
|
|
||||||
name = "nix-build";
|
|
||||||
src = tarball;
|
|
||||||
|
|
||||||
buildInputs =
|
|
||||||
[ curl perl bzip2 openssl
|
|
||||||
# These are for "make check" only:
|
|
||||||
graphviz libxml2 libxslt
|
|
||||||
];
|
|
||||||
|
|
||||||
configureFlags = ''
|
|
||||||
--disable-init-state --disable-shared
|
|
||||||
--with-bzip2=${bzip2} --with-sqlite=${sqlite}
|
|
||||||
'';
|
|
||||||
|
|
||||||
lcovFilter = [ "*/boost/*" "*-tab.*" ];
|
|
||||||
|
|
||||||
# We call `dot', and even though we just use it to
|
|
||||||
# syntax-check generated dot files, it still requires some
|
|
||||||
# fonts. So provide those.
|
|
||||||
FONTCONFIG_FILE = texFunctions.fontsConf;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
rpm_fedora5i386 = makeRPM_i686 (diskImages: diskImages.fedora5i386) 10;
|
|
||||||
rpm_fedora9i386 = makeRPM_i686 (diskImages: diskImages.fedora9i386) 20;
|
|
||||||
rpm_fedora9x86_64 = makeRPM_x86_64 (diskImages: diskImages.fedora9x86_64) 20;
|
|
||||||
rpm_fedora10i386 = makeRPM_i686 (diskImages: diskImages.fedora10i386) 30;
|
|
||||||
rpm_fedora10x86_64 = makeRPM_x86_64 (diskImages: diskImages.fedora10x86_64) 30;
|
|
||||||
rpm_fedora11i386 = makeRPM_i686 (diskImages: diskImages.fedora11i386) 40;
|
|
||||||
rpm_fedora11x86_64 = makeRPM_x86_64 (diskImages: diskImages.fedora11x86_64) 40;
|
|
||||||
rpm_fedora12i386 = makeRPM_i686 (diskImages: diskImages.fedora12i386) 50;
|
|
||||||
rpm_fedora12x86_64 = makeRPM_x86_64 (diskImages: diskImages.fedora12x86_64) 50;
|
|
||||||
rpm_opensuse103i386 = makeRPM_i686 (diskImages: diskImages.opensuse103i386) 40;
|
|
||||||
rpm_opensuse110i386 = makeRPM_i686 (diskImages: diskImages.opensuse110i386) 50;
|
|
||||||
rpm_opensuse110x86_64 = makeRPM_x86_64 (diskImages: diskImages.opensuse110x86_64) 50;
|
|
||||||
|
|
||||||
|
|
||||||
deb_debian40i386 = makeDeb_i686 (diskImages: diskImages.debian40i386) 40;
|
|
||||||
deb_debian40x86_64 = makeDeb_x86_64 (diskImages: diskImages.debian40x86_64) 40;
|
|
||||||
deb_debian50i386 = makeDeb_i686 (diskImages: diskImages.debian50i386) 50;
|
|
||||||
deb_debian50x86_64 = makeDeb_x86_64 (diskImages: diskImages.debian50x86_64) 50;
|
|
||||||
deb_ubuntu804i386 = makeDeb_i686 (diskImages: diskImages.ubuntu804i386) 20;
|
|
||||||
deb_ubuntu804x86_64 = makeDeb_x86_64 (diskImages: diskImages.ubuntu804x86_64) 20;
|
|
||||||
deb_ubuntu810i386 = makeDeb_i686 (diskImages: diskImages.ubuntu810i386) 30;
|
|
||||||
deb_ubuntu810x86_64 = makeDeb_x86_64 (diskImages: diskImages.ubuntu810x86_64) 30;
|
|
||||||
deb_ubuntu904i386 = makeDeb_i686 (diskImages: diskImages.ubuntu904i386) 40;
|
|
||||||
deb_ubuntu904x86_64 = makeDeb_x86_64 (diskImages: diskImages.ubuntu904x86_64) 40;
|
|
||||||
deb_ubuntu910i386 = makeDeb_i686 (diskImages: diskImages.ubuntu910i386) 50;
|
|
||||||
deb_ubuntu910x86_64 = makeDeb_x86_64 (diskImages: diskImages.ubuntu910x86_64) 50;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
makeRPM_i686 = makeRPM "i686-linux";
|
|
||||||
makeRPM_x86_64 = makeRPM "x86_64-linux";
|
|
||||||
|
|
||||||
makeRPM =
|
|
||||||
system: diskImageFun: prio:
|
|
||||||
|
|
||||||
with import nixpkgs { inherit system; };
|
|
||||||
|
|
||||||
releaseTools.rpmBuild rec {
|
|
||||||
name = "nix-rpm-${diskImage.name}";
|
|
||||||
src = jobs.tarball;
|
|
||||||
diskImage = diskImageFun vmTools.diskImages;
|
|
||||||
memSize = 1024;
|
|
||||||
meta.schedulingPriority = prio;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
makeDeb_i686 = makeDeb "i686-linux";
|
|
||||||
makeDeb_x86_64 = makeDeb "x86_64-linux";
|
|
||||||
|
|
||||||
makeDeb =
|
|
||||||
system: diskImageFun: prio:
|
|
||||||
|
|
||||||
with import nixpkgs { inherit system; };
|
|
||||||
|
|
||||||
releaseTools.debBuild {
|
|
||||||
name = "nix-deb";
|
|
||||||
src = jobs.tarball;
|
|
||||||
diskImage = diskImageFun vmTools.diskImages;
|
|
||||||
memSize = 1024;
|
|
||||||
meta.schedulingPriority = prio;
|
|
||||||
configureFlags = "--sysconfdir=/etc";
|
|
||||||
debRequires = [ "curl" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
in jobs
|
|
||||||
@@ -1,334 +0,0 @@
|
|||||||
#! @perl@ -w -I@libexecdir@/nix
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use File::Temp qw(tempdir);
|
|
||||||
|
|
||||||
|
|
||||||
# Some patch generations options.
|
|
||||||
|
|
||||||
# Max size of NAR archives to generate patches for.
|
|
||||||
my $maxNarSize = $ENV{"NIX_MAX_NAR_SIZE"};
|
|
||||||
$maxNarSize = 160 * 1024 * 1024 if !defined $maxNarSize;
|
|
||||||
|
|
||||||
# If patch is bigger than this fraction of full archive, reject.
|
|
||||||
my $maxPatchFraction = $ENV{"NIX_PATCH_FRACTION"};
|
|
||||||
$maxPatchFraction = 0.60 if !defined $maxPatchFraction;
|
|
||||||
|
|
||||||
my $timeLimit = $ENV{"NIX_BSDIFF_TIME_LIMIT"};
|
|
||||||
$timeLimit = 180 if !defined $timeLimit;
|
|
||||||
|
|
||||||
my $hashAlgo = "sha256";
|
|
||||||
|
|
||||||
|
|
||||||
sub findOutputPaths {
|
|
||||||
my $narFiles = shift;
|
|
||||||
|
|
||||||
my %outPaths;
|
|
||||||
|
|
||||||
foreach my $p (keys %{$narFiles}) {
|
|
||||||
|
|
||||||
# Ignore derivations.
|
|
||||||
next if ($p =~ /\.drv$/);
|
|
||||||
|
|
||||||
# Ignore builders (too much ambiguity -- they're all called
|
|
||||||
# `builder.sh').
|
|
||||||
next if ($p =~ /\.sh$/);
|
|
||||||
next if ($p =~ /\.patch$/);
|
|
||||||
|
|
||||||
# Don't bother including tar files etc.
|
|
||||||
next if ($p =~ /\.tar$/ || $p =~ /\.tar\.(gz|bz2|Z|lzma|xz)$/ || $p =~ /\.zip$/ || $p =~ /\.bin$/ || $p =~ /\.tgz$/ || $p =~ /\.rpm$/ || $p =~ /cvs-export$/ || $p =~ /fetchhg$/);
|
|
||||||
|
|
||||||
$outPaths{$p} = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return %outPaths;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub getNameVersion {
|
|
||||||
my $p = shift;
|
|
||||||
$p =~ /\/[0-9a-z]+((?:-[a-zA-Z][^\/-]*)+)([^\/]*)$/;
|
|
||||||
my $name = $1;
|
|
||||||
my $version = $2;
|
|
||||||
return undef unless defined $name && defined $version;
|
|
||||||
$name =~ s/^-//;
|
|
||||||
$version =~ s/^-//;
|
|
||||||
return ($name, $version);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# A quick hack to get a measure of the `distance' between two
|
|
||||||
# versions: it's just the position of the first character that differs
|
|
||||||
# (or 999 if they are the same).
|
|
||||||
sub versionDiff {
|
|
||||||
my $s = shift;
|
|
||||||
my $t = shift;
|
|
||||||
my $i;
|
|
||||||
return 999 if $s eq $t;
|
|
||||||
for ($i = 0; $i < length $s; $i++) {
|
|
||||||
return $i if $i >= length $t or
|
|
||||||
substr($s, $i, 1) ne substr($t, $i, 1);
|
|
||||||
}
|
|
||||||
return $i;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub getNarBz2 {
|
|
||||||
my $narPath = shift;
|
|
||||||
my $narFiles = shift;
|
|
||||||
my $storePath = shift;
|
|
||||||
|
|
||||||
my $narFileList = $$narFiles{$storePath};
|
|
||||||
die "missing path $storePath" unless defined $narFileList;
|
|
||||||
|
|
||||||
my $narFile = @{$narFileList}[0];
|
|
||||||
die unless defined $narFile;
|
|
||||||
|
|
||||||
$narFile->{url} =~ /\/([^\/]+)$/;
|
|
||||||
die unless defined $1;
|
|
||||||
return "$narPath/$1";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub containsPatch {
|
|
||||||
my $patches = shift;
|
|
||||||
my $storePath = shift;
|
|
||||||
my $basePath = shift;
|
|
||||||
my $patchList = $$patches{$storePath};
|
|
||||||
return 0 if !defined $patchList;
|
|
||||||
my $found = 0;
|
|
||||||
foreach my $patch (@{$patchList}) {
|
|
||||||
# !!! baseHash might differ
|
|
||||||
return 1 if $patch->{basePath} eq $basePath;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub generatePatches {
|
|
||||||
my ($srcNarFiles, $dstNarFiles, $srcPatches, $dstPatches, $narPath, $patchesPath, $patchesURL, $tmpDir) = @_;
|
|
||||||
|
|
||||||
my %srcOutPaths = findOutputPaths $srcNarFiles;
|
|
||||||
my %dstOutPaths = findOutputPaths $dstNarFiles;
|
|
||||||
|
|
||||||
# For each output path in the destination, see if we need to / can
|
|
||||||
# create a patch.
|
|
||||||
|
|
||||||
print STDERR "creating patches...\n";
|
|
||||||
|
|
||||||
foreach my $p (keys %dstOutPaths) {
|
|
||||||
|
|
||||||
# If exactly the same path already exists in the source, skip it.
|
|
||||||
next if defined $srcOutPaths{$p};
|
|
||||||
|
|
||||||
print " $p\n";
|
|
||||||
|
|
||||||
# If not, then we should find the paths in the source that are
|
|
||||||
# `most' likely to be present on a system that wants to
|
|
||||||
# install this path.
|
|
||||||
|
|
||||||
(my $name, my $version) = getNameVersion $p;
|
|
||||||
next unless defined $name && defined $version;
|
|
||||||
|
|
||||||
my @closest = ();
|
|
||||||
my $closestVersion;
|
|
||||||
my $minDist = -1; # actually, larger means closer
|
|
||||||
|
|
||||||
# Find all source paths with the same name.
|
|
||||||
|
|
||||||
foreach my $q (keys %srcOutPaths) {
|
|
||||||
(my $name2, my $version2) = getNameVersion $q;
|
|
||||||
next unless defined $name2 && defined $version2;
|
|
||||||
|
|
||||||
if ($name eq $name2) {
|
|
||||||
|
|
||||||
my $srcSystem = @{$$dstNarFiles{$p}}[0]->{system};
|
|
||||||
my $dstSystem = @{$$srcNarFiles{$q}}[0]->{system};
|
|
||||||
if (defined $srcSystem && defined $dstSystem && $srcSystem ne $dstSystem) {
|
|
||||||
print " SKIPPING $q due to different systems ($srcSystem vs. $dstSystem)\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# If the sizes differ too much, then skip. This
|
|
||||||
# disambiguates between, e.g., a real component and a
|
|
||||||
# wrapper component (cf. Firefox in Nixpkgs).
|
|
||||||
my $srcSize = @{$$srcNarFiles{$q}}[0]->{size};
|
|
||||||
my $dstSize = @{$$dstNarFiles{$p}}[0]->{size};
|
|
||||||
my $ratio = $srcSize / $dstSize;
|
|
||||||
$ratio = 1 / $ratio if $ratio < 1;
|
|
||||||
# print " SIZE $srcSize $dstSize $ratio $q\n";
|
|
||||||
|
|
||||||
if ($ratio >= 3) {
|
|
||||||
print " SKIPPING $q due to size ratio $ratio ($srcSize vs. $dstSize)\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# If there are multiple matching names, include the
|
|
||||||
# ones with the closest version numbers.
|
|
||||||
my $dist = versionDiff $version, $version2;
|
|
||||||
if ($dist > $minDist) {
|
|
||||||
$minDist = $dist;
|
|
||||||
@closest = ($q);
|
|
||||||
$closestVersion = $version2;
|
|
||||||
} elsif ($dist == $minDist) {
|
|
||||||
push @closest, $q;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scalar(@closest) == 0) {
|
|
||||||
print " NO BASE: $p\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $closest (@closest) {
|
|
||||||
|
|
||||||
# Generate a patch between $closest and $p.
|
|
||||||
print STDERR " $p <- $closest\n";
|
|
||||||
|
|
||||||
# If the patch already exists, skip it.
|
|
||||||
if (containsPatch($srcPatches, $p, $closest) ||
|
|
||||||
containsPatch($dstPatches, $p, $closest))
|
|
||||||
{
|
|
||||||
print " skipping, already exists\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $srcNarBz2 = getNarBz2 $narPath, $srcNarFiles, $closest;
|
|
||||||
my $dstNarBz2 = getNarBz2 $narPath, $dstNarFiles, $p;
|
|
||||||
|
|
||||||
if (! -f $srcNarBz2) {
|
|
||||||
warn "patch source archive $srcNarBz2 is missing\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
system("@bunzip2@ < $srcNarBz2 > $tmpDir/A") == 0
|
|
||||||
or die "cannot unpack $srcNarBz2";
|
|
||||||
|
|
||||||
if ((stat "$tmpDir/A")[7] >= $maxNarSize) {
|
|
||||||
print " skipping, source is too large\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
system("@bunzip2@ < $dstNarBz2 > $tmpDir/B") == 0
|
|
||||||
or die "cannot unpack $dstNarBz2";
|
|
||||||
|
|
||||||
if ((stat "$tmpDir/B")[7] >= $maxNarSize) {
|
|
||||||
print " skipping, destination is too large\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $time1 = time();
|
|
||||||
my $res = system("ulimit -t $timeLimit; @libexecdir@/bsdiff $tmpDir/A $tmpDir/B $tmpDir/DIFF");
|
|
||||||
my $time2 = time();
|
|
||||||
if ($res) {
|
|
||||||
warn "binary diff computation aborted after ", $time2 - $time1, " seconds\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $baseHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpDir/A` or die;
|
|
||||||
chomp $baseHash;
|
|
||||||
|
|
||||||
my $narHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpDir/B` or die;
|
|
||||||
chomp $narHash;
|
|
||||||
|
|
||||||
my $narDiffHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpDir/DIFF` or die;
|
|
||||||
chomp $narDiffHash;
|
|
||||||
|
|
||||||
my $narDiffSize = (stat "$tmpDir/DIFF")[7];
|
|
||||||
my $dstNarBz2Size = (stat $dstNarBz2)[7];
|
|
||||||
|
|
||||||
print " size $narDiffSize; full size $dstNarBz2Size; ", $time2 - $time1, " seconds\n";
|
|
||||||
|
|
||||||
if ($narDiffSize >= $dstNarBz2Size) {
|
|
||||||
print " rejecting; patch bigger than full archive\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($narDiffSize / $dstNarBz2Size >= $maxPatchFraction) {
|
|
||||||
print " rejecting; patch too large relative to full archive\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $finalName = "$narDiffHash.nar-bsdiff";
|
|
||||||
|
|
||||||
if (-e "$patchesPath/$finalName") {
|
|
||||||
print " not copying, already exists\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
system("cp '$tmpDir/DIFF' '$patchesPath/$finalName.tmp'") == 0
|
|
||||||
or die "cannot copy diff";
|
|
||||||
rename("$patchesPath/$finalName.tmp", "$patchesPath/$finalName")
|
|
||||||
or die "cannot rename $patchesPath/$finalName.tmp";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add the patch to the manifest.
|
|
||||||
addPatch $dstPatches, $p,
|
|
||||||
{ url => "$patchesURL/$finalName", hash => "$hashAlgo:$narDiffHash"
|
|
||||||
, size => $narDiffSize, basePath => $closest, baseHash => "$hashAlgo:$baseHash"
|
|
||||||
, narHash => "$hashAlgo:$narHash", patchType => "nar-bsdiff"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Propagate useful patches from $srcPatches to $dstPatches. A patch
|
|
||||||
# is useful if it produces either paths in the $dstNarFiles or paths
|
|
||||||
# that can be used as the base for other useful patches.
|
|
||||||
sub propagatePatches {
|
|
||||||
my ($srcPatches, $dstNarFiles, $dstPatches) = @_;
|
|
||||||
|
|
||||||
print STDERR "propagating patches...\n";
|
|
||||||
|
|
||||||
my $changed;
|
|
||||||
do {
|
|
||||||
# !!! we repeat this to reach the transitive closure; inefficient
|
|
||||||
$changed = 0;
|
|
||||||
|
|
||||||
print STDERR "loop\n";
|
|
||||||
|
|
||||||
my %dstBasePaths;
|
|
||||||
foreach my $q (keys %{$dstPatches}) {
|
|
||||||
foreach my $patch (@{$$dstPatches{$q}}) {
|
|
||||||
$dstBasePaths{$patch->{basePath}} = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $p (keys %{$srcPatches}) {
|
|
||||||
my $patchList = $$srcPatches{$p};
|
|
||||||
|
|
||||||
my $include = 0;
|
|
||||||
|
|
||||||
# Is path $p included in the destination? If so, include
|
|
||||||
# patches that produce it.
|
|
||||||
$include = 1 if defined $$dstNarFiles{$p};
|
|
||||||
|
|
||||||
# Is path $p a path that serves as a base for paths in the
|
|
||||||
# destination? If so, include patches that produce it.
|
|
||||||
# !!! check baseHash
|
|
||||||
$include = 1 if defined $dstBasePaths{$p};
|
|
||||||
|
|
||||||
if ($include) {
|
|
||||||
foreach my $patch (@{$patchList}) {
|
|
||||||
$changed = 1 if addPatch $dstPatches, $p, $patch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} while $changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Add all new patches in $srcPatches to $dstPatches.
|
|
||||||
sub copyPatches {
|
|
||||||
my ($srcPatches, $dstPatches) = @_;
|
|
||||||
foreach my $p (keys %{$srcPatches}) {
|
|
||||||
addPatch $dstPatches, $p, $_ foreach @{$$srcPatches{$p}};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
+8
-27
@@ -1,27 +1,17 @@
|
|||||||
bin_SCRIPTS = nix-collect-garbage \
|
bin_SCRIPTS = nix-collect-garbage \
|
||||||
nix-pull nix-push nix-prefetch-url \
|
nix-pull nix-push nix-prefetch-url \
|
||||||
nix-install-package nix-channel nix-build \
|
nix-install-package nix-channel nix-build
|
||||||
nix-copy-closure nix-generate-patches
|
|
||||||
|
|
||||||
noinst_SCRIPTS = nix-profile.sh GeneratePatches.pm \
|
noinst_SCRIPTS = nix-profile.sh generate-patches.pl
|
||||||
find-runtime-roots.pl build-remote.pl nix-reduce-build \
|
|
||||||
copy-from-other-stores.pl nix-http-export.cgi
|
|
||||||
|
|
||||||
nix-pull nix-push: NixManifest.pm NixConfig.pm download-using-manifests.pl
|
nix-pull nix-push: readmanifest.pm download-using-manifests.pl
|
||||||
|
|
||||||
install-exec-local: NixManifest.pm GeneratePatches.pm download-using-manifests.pl copy-from-other-stores.pl find-runtime-roots.pl
|
install-exec-local: readmanifest.pm download-using-manifests.pl
|
||||||
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/profile.d
|
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/profile.d
|
||||||
$(INSTALL_PROGRAM) nix-profile.sh $(DESTDIR)$(sysconfdir)/profile.d/nix.sh
|
$(INSTALL_PROGRAM) nix-profile.sh $(DESTDIR)$(sysconfdir)/profile.d/nix.sh
|
||||||
$(INSTALL) -d $(DESTDIR)$(libexecdir)/nix
|
$(INSTALL) -d $(DESTDIR)$(libexecdir)/nix
|
||||||
$(INSTALL_DATA) NixManifest.pm $(DESTDIR)$(libexecdir)/nix
|
$(INSTALL_DATA) readmanifest.pm $(DESTDIR)$(libexecdir)/nix
|
||||||
$(INSTALL_DATA) NixConfig.pm $(DESTDIR)$(libexecdir)/nix
|
$(INSTALL_PROGRAM) download-using-manifests.pl $(DESTDIR)$(libexecdir)/nix
|
||||||
$(INSTALL_DATA) SSH.pm $(DESTDIR)$(libexecdir)/nix
|
|
||||||
$(INSTALL_DATA) GeneratePatches.pm $(DESTDIR)$(libexecdir)/nix
|
|
||||||
$(INSTALL_PROGRAM) find-runtime-roots.pl $(DESTDIR)$(libexecdir)/nix
|
|
||||||
$(INSTALL_PROGRAM) build-remote.pl $(DESTDIR)$(libexecdir)/nix
|
|
||||||
$(INSTALL) -d $(DESTDIR)$(libexecdir)/nix/substituters
|
|
||||||
$(INSTALL_PROGRAM) download-using-manifests.pl $(DESTDIR)$(libexecdir)/nix/substituters
|
|
||||||
$(INSTALL_PROGRAM) copy-from-other-stores.pl $(DESTDIR)$(libexecdir)/nix/substituters
|
|
||||||
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/nix
|
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/nix
|
||||||
|
|
||||||
include ../substitute.mk
|
include ../substitute.mk
|
||||||
@@ -30,16 +20,7 @@ EXTRA_DIST = nix-collect-garbage.in \
|
|||||||
nix-pull.in nix-push.in nix-profile.sh.in \
|
nix-pull.in nix-push.in nix-profile.sh.in \
|
||||||
nix-prefetch-url.in nix-install-package.in \
|
nix-prefetch-url.in nix-install-package.in \
|
||||||
nix-channel.in \
|
nix-channel.in \
|
||||||
NixManifest.pm.in \
|
readmanifest.pm.in \
|
||||||
NixConfig.pm.in \
|
|
||||||
SSH.pm \
|
|
||||||
GeneratePatches.pm.in \
|
|
||||||
nix-build.in \
|
nix-build.in \
|
||||||
download-using-manifests.pl.in \
|
download-using-manifests.pl.in \
|
||||||
copy-from-other-stores.pl.in \
|
generate-patches.pl.in
|
||||||
nix-copy-closure.in \
|
|
||||||
find-runtime-roots.pl.in \
|
|
||||||
build-remote.pl.in \
|
|
||||||
nix-reduce-build.in \
|
|
||||||
nix-http-export.cgi.in \
|
|
||||||
nix-generate-patches.in
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
use strict;
|
|
||||||
|
|
||||||
sub readConfig {
|
|
||||||
my %config;
|
|
||||||
my $config = "@sysconfdir@/nix/nix.conf";
|
|
||||||
return unless -f $config;
|
|
||||||
|
|
||||||
open CONFIG, "<$config" or die "cannot open `$config'";
|
|
||||||
while (<CONFIG>) {
|
|
||||||
/^\s*([\w|-]+)\s*=\s*(.*)$/ or next;
|
|
||||||
$config{$1} = $2;
|
|
||||||
print "|$1| -> |$2|\n";
|
|
||||||
}
|
|
||||||
close CONFIG;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
use strict;
|
|
||||||
use File::Temp qw(tempdir);
|
|
||||||
|
|
||||||
our @sshOpts = split ' ', ($ENV{"NIX_SSHOPTS"} or "");
|
|
||||||
|
|
||||||
push @sshOpts, "-x";
|
|
||||||
|
|
||||||
my $sshStarted = 0;
|
|
||||||
my $sshHost;
|
|
||||||
|
|
||||||
# Open a master SSH connection to `host', unless there already is a
|
|
||||||
# running master connection (as determined by `-O check').
|
|
||||||
sub openSSHConnection {
|
|
||||||
my ($host) = @_;
|
|
||||||
die if $sshStarted;
|
|
||||||
$sshHost = $host;
|
|
||||||
return 1 if system("ssh $sshHost @sshOpts -O check 2> /dev/null") == 0;
|
|
||||||
|
|
||||||
my $tmpDir = tempdir("nix-ssh.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
|
||||||
or die "cannot create a temporary directory";
|
|
||||||
|
|
||||||
push @sshOpts, "-S", "$tmpDir/control";
|
|
||||||
|
|
||||||
# Start the master. We can't use the `-f' flag (fork into
|
|
||||||
# background after establishing the connection) because then the
|
|
||||||
# child continues to run if we are killed. So instead make SSH
|
|
||||||
# print "started" when it has established the connection, and wait
|
|
||||||
# until we see that.
|
|
||||||
open SSHPIPE, "ssh $sshHost @sshOpts -M -N -o LocalCommand='echo started' -o PermitLocalCommand=yes |" or die;
|
|
||||||
|
|
||||||
while (<SSHPIPE>) {
|
|
||||||
chomp;
|
|
||||||
if ($_ eq "started") {
|
|
||||||
$sshStarted = 1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Tell the master SSH client to exit.
|
|
||||||
sub closeSSHConnection {
|
|
||||||
if ($sshStarted) {
|
|
||||||
system("ssh $sshHost @sshOpts -O exit 2> /dev/null") == 0
|
|
||||||
or warn "unable to stop SSH master: $?";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
END { my $saved = $?; closeSSHConnection; $? = $saved; }
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
@@ -1,269 +0,0 @@
|
|||||||
#! @perl@ -w -I@libexecdir@/nix
|
|
||||||
|
|
||||||
use Fcntl ':flock';
|
|
||||||
use English '-no_match_vars';
|
|
||||||
use IO::Handle;
|
|
||||||
use SSH qw/sshOpts openSSHConnection/;
|
|
||||||
no warnings('once');
|
|
||||||
|
|
||||||
|
|
||||||
# General operation:
|
|
||||||
#
|
|
||||||
# Try to find a free machine of type $neededSystem. We do this as
|
|
||||||
# follows:
|
|
||||||
# - We acquire an exclusive lock on $currentLoad/main-lock.
|
|
||||||
# - For each machine $machine of type $neededSystem and for each $slot
|
|
||||||
# less than the maximum load for that machine, we try to get an
|
|
||||||
# exclusive lock on $currentLoad/$machine-$slot (without blocking).
|
|
||||||
# If we get such a lock, we send "accept" to the caller. Otherwise,
|
|
||||||
# we send "postpone" and exit.
|
|
||||||
# - We release the exclusive lock on $currentLoad/main-lock.
|
|
||||||
# - We perform the build on $neededSystem.
|
|
||||||
# - We release the exclusive lock on $currentLoad/$machine-$slot.
|
|
||||||
#
|
|
||||||
# The nice thing about this scheme is that if we die prematurely, the
|
|
||||||
# locks are released automatically.
|
|
||||||
|
|
||||||
|
|
||||||
# Make sure that we don't get any SSH passphrase or host key popups -
|
|
||||||
# if there is any problem it should fail, not do something
|
|
||||||
# interactive.
|
|
||||||
$ENV{"DISPLAY"} = "";
|
|
||||||
$ENV{"SSH_ASKPASS"} = "";
|
|
||||||
|
|
||||||
|
|
||||||
sub sendReply {
|
|
||||||
my $reply = shift;
|
|
||||||
print STDERR "# $reply\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub all { $_ || return 0 for @_; 1 }
|
|
||||||
|
|
||||||
|
|
||||||
# Initialisation.
|
|
||||||
my $loadIncreased = 0;
|
|
||||||
|
|
||||||
my ($localSystem, $maxSilentTime, $printBuildTrace) = @ARGV;
|
|
||||||
$maxSilentTime = 0 unless defined $maxSilentTime;
|
|
||||||
|
|
||||||
my $currentLoad = $ENV{"NIX_CURRENT_LOAD"};
|
|
||||||
my $conf = $ENV{"NIX_REMOTE_SYSTEMS"};
|
|
||||||
|
|
||||||
|
|
||||||
sub openSlotLock {
|
|
||||||
my ($machine, $slot) = @_;
|
|
||||||
my $slotLockFn = "$currentLoad/" . (join '+', @{$machine->{systemTypes}}) . "-" . $machine->{hostName} . "-$slot";
|
|
||||||
my $slotLock = new IO::Handle;
|
|
||||||
open $slotLock, ">>$slotLockFn" or die;
|
|
||||||
return $slotLock;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Read the list of machines.
|
|
||||||
my @machines;
|
|
||||||
if (defined $conf && -e $conf) {
|
|
||||||
open CONF, "< $conf" or die;
|
|
||||||
while (<CONF>) {
|
|
||||||
chomp;
|
|
||||||
s/\#.*$//g;
|
|
||||||
next if /^\s*$/;
|
|
||||||
my @tokens = split /\s/, $_;
|
|
||||||
push @machines,
|
|
||||||
{ hostName => $tokens[0]
|
|
||||||
, systemTypes => [ split(/,/, $tokens[1]) ]
|
|
||||||
, sshKeys => $tokens[2]
|
|
||||||
, maxJobs => int($tokens[3])
|
|
||||||
, speedFactor => 1.0 * (defined $tokens[4] ? int($tokens[4]) : 1)
|
|
||||||
, features => [ split(/,/, $tokens[5] || "") ]
|
|
||||||
, enabled => 1
|
|
||||||
};
|
|
||||||
}
|
|
||||||
close CONF;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Wait for the calling process to ask us whether we can build some derivation.
|
|
||||||
my ($drvPath, $hostName, $slotLock);
|
|
||||||
|
|
||||||
REQ: while (1) {
|
|
||||||
$_ = <STDIN> || exit 0;
|
|
||||||
my ($amWilling, $neededSystem);
|
|
||||||
($amWilling, $neededSystem, $drvPath, $requiredFeatures) = split;
|
|
||||||
my @requiredFeatures = split /,/, $requiredFeatures;
|
|
||||||
|
|
||||||
my $canBuildLocally = $amWilling && ($localSystem eq $neededSystem);
|
|
||||||
|
|
||||||
if (!defined $currentLoad) {
|
|
||||||
sendReply "decline";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Acquire the exclusive lock on $currentLoad/main-lock.
|
|
||||||
mkdir $currentLoad, 0777 or die unless -d $currentLoad;
|
|
||||||
my $mainLock = "$currentLoad/main-lock";
|
|
||||||
open MAINLOCK, ">>$mainLock" or die;
|
|
||||||
flock(MAINLOCK, LOCK_EX) or die;
|
|
||||||
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
# Find all machine that can execute this build, i.e., that
|
|
||||||
# support builds for the given platform and features, and are
|
|
||||||
# not at their job limit.
|
|
||||||
my $rightType = 0;
|
|
||||||
my @available = ();
|
|
||||||
LOOP: foreach my $cur (@machines) {
|
|
||||||
if ($cur->{enabled}
|
|
||||||
&& (grep { $neededSystem eq $_ } @{$cur->{systemTypes}})
|
|
||||||
&& all(map { my $f = $_; 0 != grep { $f eq $_ } @{$cur->{features}} } @requiredFeatures))
|
|
||||||
{
|
|
||||||
$rightType = 1;
|
|
||||||
|
|
||||||
# We have a machine of the right type. Determine the load on
|
|
||||||
# the machine.
|
|
||||||
my $slot = 0;
|
|
||||||
my $load = 0;
|
|
||||||
my $free;
|
|
||||||
while ($slot < $cur->{maxJobs}) {
|
|
||||||
my $slotLock = openSlotLock($cur, $slot);
|
|
||||||
if (flock($slotLock, LOCK_EX | LOCK_NB)) {
|
|
||||||
$free = $slot unless defined $free;
|
|
||||||
flock($slotLock, LOCK_UN) or die;
|
|
||||||
} else {
|
|
||||||
$load++;
|
|
||||||
}
|
|
||||||
close $slotLock;
|
|
||||||
$slot++;
|
|
||||||
}
|
|
||||||
|
|
||||||
push @available, { machine => $cur, load => $load, free => $free }
|
|
||||||
if $load < $cur->{maxJobs};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defined $ENV{NIX_DEBUG_HOOK}) {
|
|
||||||
print STDERR "load on " . $_->{machine}->{hostName} . " = " . $_->{load} . "\n"
|
|
||||||
foreach @available;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Didn't find any available machine? Then decline or postpone.
|
|
||||||
if (scalar @available == 0) {
|
|
||||||
# Postpone if we have a machine of the right type, except
|
|
||||||
# if the local system can and wants to do the build.
|
|
||||||
if ($rightType && !$canBuildLocally) {
|
|
||||||
sendReply "postpone";
|
|
||||||
} else {
|
|
||||||
sendReply "decline";
|
|
||||||
}
|
|
||||||
close MAINLOCK;
|
|
||||||
next REQ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Prioritise the available machines as follows:
|
|
||||||
# - First by load divided by speed factor, rounded to the nearest
|
|
||||||
# integer. This causes fast machines to be preferred over slow
|
|
||||||
# machines with similar loads.
|
|
||||||
# - Then by speed factor.
|
|
||||||
# - Finally by load.
|
|
||||||
sub lf { my $x = shift; return int($x->{load} / $x->{machine}->{speedFactor} + 0.4999); }
|
|
||||||
@available = sort
|
|
||||||
{ lf($a) <=> lf($b)
|
|
||||||
|| $b->{machine}->{speedFactor} <=> $a->{machine}->{speedFactor}
|
|
||||||
|| $a->{load} <=> $b->{load}
|
|
||||||
} @available;
|
|
||||||
|
|
||||||
|
|
||||||
# Select the best available machine and lock a free slot.
|
|
||||||
my $selected = $available[0];
|
|
||||||
my $machine = $selected->{machine};
|
|
||||||
|
|
||||||
$slotLock = openSlotLock($machine, $selected->{free});
|
|
||||||
flock($slotLock, LOCK_EX | LOCK_NB) or die;
|
|
||||||
utime undef, undef, $slotLock;
|
|
||||||
|
|
||||||
close MAINLOCK;
|
|
||||||
|
|
||||||
|
|
||||||
# Connect to the selected machine.
|
|
||||||
@sshOpts = ("-i", $machine->{sshKeys}, "-x");
|
|
||||||
$hostName = $machine->{hostName};
|
|
||||||
last REQ if openSSHConnection $hostName;
|
|
||||||
|
|
||||||
warn "unable to open SSH connection to $hostName, trying other available machines...\n";
|
|
||||||
$machine->{enabled} = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Tell Nix we've accepted the build.
|
|
||||||
sendReply "accept";
|
|
||||||
my @inputs = split /\s/, readline(STDIN);
|
|
||||||
my @outputs = split /\s/, readline(STDIN);
|
|
||||||
|
|
||||||
|
|
||||||
print STDERR "building `$drvPath' on `$hostName'\n";
|
|
||||||
print STDERR "@ build-remote $drvPath $hostName\n" if $printBuildTrace;
|
|
||||||
|
|
||||||
|
|
||||||
my $maybeSign = "";
|
|
||||||
$maybeSign = "--sign" if -e "/nix/etc/nix/signing-key.sec";
|
|
||||||
|
|
||||||
|
|
||||||
# Register the derivation as a temporary GC root. Note that $PPID is
|
|
||||||
# the PID of the remote SSH process, which, due to the use of a
|
|
||||||
# persistant SSH connection, should be the same across all remote
|
|
||||||
# command invocations for this session.
|
|
||||||
my $rootsDir = "@localstatedir@/nix/gcroots/tmp";
|
|
||||||
system("ssh $hostName @sshOpts 'mkdir -m 1777 -p $rootsDir; ln -sfn $drvPath $rootsDir/\$PPID.drv'");
|
|
||||||
|
|
||||||
sub removeRoots {
|
|
||||||
system("ssh $hostName @sshOpts 'rm -f $rootsDir/\$PPID.drv $rootsDir/\$PPID.out'");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Copy the derivation and its dependencies to the build machine.
|
|
||||||
system("NIX_SSHOPTS=\"@sshOpts\" @bindir@/nix-copy-closure $hostName $maybeSign $drvPath @inputs") == 0
|
|
||||||
or die "cannot copy inputs to $hostName: $?";
|
|
||||||
|
|
||||||
|
|
||||||
# Perform the build.
|
|
||||||
my $buildFlags = "--max-silent-time $maxSilentTime --fallback --add-root $rootsDir/\$PPID.out --option verbosity 0";
|
|
||||||
|
|
||||||
# We let the remote side kill its process group when the connection is
|
|
||||||
# closed unexpectedly. This is necessary to ensure that no processes
|
|
||||||
# are left running on the remote system if the local Nix process is
|
|
||||||
# killed. (SSH itself doesn't kill child processes if the connection
|
|
||||||
# is interrupted unless the `-tt' flag is used to force a pseudo-tty,
|
|
||||||
# in which case every child receives SIGHUP; however, `-tt' doesn't
|
|
||||||
# work on some platforms when connection sharing is used.)
|
|
||||||
pipe STDIN, DUMMY; # make sure we have a readable STDIN
|
|
||||||
if (system("ssh $hostName @sshOpts '(read; kill -INT -\$\$) <&0 & nix-store -r $drvPath $buildFlags > /dev/null' 2>&4") != 0) {
|
|
||||||
# Note that if we get exit code 100 from `nix-store -r', it
|
|
||||||
# denotes a permanent build failure (as opposed to an SSH problem
|
|
||||||
# or a temporary Nix problem). We propagate this to the caller to
|
|
||||||
# allow it to distinguish between transient and permanent
|
|
||||||
# failures.
|
|
||||||
my $res = $? >> 8;
|
|
||||||
print STDERR "build of `$drvPath' on `$hostName' failed with exit code $res\n";
|
|
||||||
removeRoots;
|
|
||||||
exit $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
#print "build of `$drvPath' on `$hostName' succeeded\n";
|
|
||||||
|
|
||||||
|
|
||||||
# Copy the output from the build machine.
|
|
||||||
foreach my $output (@outputs) {
|
|
||||||
my $maybeSignRemote = "";
|
|
||||||
$maybeSignRemote = "--sign" if $UID != 0;
|
|
||||||
|
|
||||||
system("ssh $hostName @sshOpts 'nix-store --export $maybeSignRemote $output'" .
|
|
||||||
"| NIX_HELD_LOCKS=$output @bindir@/nix-store --import > /dev/null") == 0
|
|
||||||
or die "cannot copy $output from $hostName: $?";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Get rid of the temporary GC roots.
|
|
||||||
removeRoots;
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
#! @perl@ -w
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use File::Basename;
|
|
||||||
use IO::Handle;
|
|
||||||
|
|
||||||
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
|
||||||
|
|
||||||
|
|
||||||
STDOUT->autoflush(1);
|
|
||||||
|
|
||||||
my @remoteStoresAll = split ':', ($ENV{"NIX_OTHER_STORES"} or "");
|
|
||||||
|
|
||||||
my @remoteStores;
|
|
||||||
foreach my $dir (@remoteStoresAll) {
|
|
||||||
push @remoteStores, glob($dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$ENV{"NIX_REMOTE"} = "";
|
|
||||||
|
|
||||||
|
|
||||||
sub findStorePath {
|
|
||||||
my $storePath = shift;
|
|
||||||
foreach my $store (@remoteStores) {
|
|
||||||
my $sourcePath = "$store/store/" . basename $storePath;
|
|
||||||
next unless -e $sourcePath || -l $sourcePath;
|
|
||||||
$ENV{"NIX_DB_DIR"} = "$store/var/nix/db";
|
|
||||||
return ($store, $sourcePath) if
|
|
||||||
system("@bindir@/nix-store --check-validity $storePath") == 0;
|
|
||||||
}
|
|
||||||
return undef;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($ARGV[0] eq "--query") {
|
|
||||||
|
|
||||||
while (<STDIN>) {
|
|
||||||
my $cmd = $_; chomp $cmd;
|
|
||||||
|
|
||||||
if ($cmd eq "have") {
|
|
||||||
my $storePath = <STDIN>; chomp $storePath;
|
|
||||||
print STDOUT (defined findStorePath($storePath) ? "1\n" : "0\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($cmd eq "info") {
|
|
||||||
my $storePath = <STDIN>; chomp $storePath;
|
|
||||||
my ($store, $sourcePath) = findStorePath($storePath);
|
|
||||||
if (!defined $store) {
|
|
||||||
print "0\n";
|
|
||||||
next; # not an error
|
|
||||||
}
|
|
||||||
print "1\n";
|
|
||||||
|
|
||||||
$ENV{"NIX_DB_DIR"} = "$store/var/nix/db";
|
|
||||||
|
|
||||||
my $deriver = `@bindir@/nix-store --query --deriver $storePath`;
|
|
||||||
die "cannot query deriver of `$storePath'" if $? != 0;
|
|
||||||
chomp $deriver;
|
|
||||||
$deriver = "" if $deriver eq "unknown-deriver";
|
|
||||||
|
|
||||||
my @references = split "\n",
|
|
||||||
`@bindir@/nix-store --query --references $storePath`;
|
|
||||||
die "cannot query references of `$storePath'" if $? != 0;
|
|
||||||
|
|
||||||
my $narSize = `@bindir@/nix-store --query --size $storePath`;
|
|
||||||
die "cannot query size of `$storePath'" if $? != 0;
|
|
||||||
chomp $narSize;
|
|
||||||
|
|
||||||
print "$deriver\n";
|
|
||||||
print scalar @references, "\n";
|
|
||||||
print "$_\n" foreach @references;
|
|
||||||
print "$narSize\n";
|
|
||||||
print "$narSize\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
else { die "unknown command `$cmd'"; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
elsif ($ARGV[0] eq "--substitute") {
|
|
||||||
die unless scalar @ARGV == 2;
|
|
||||||
my $storePath = $ARGV[1];
|
|
||||||
my ($store, $sourcePath) = findStorePath $storePath;
|
|
||||||
die unless $store;
|
|
||||||
print "\n*** Copying `$storePath' from `$sourcePath'\n\n";
|
|
||||||
system("$binDir/nix-store --dump $sourcePath | $binDir/nix-store --restore $storePath") == 0
|
|
||||||
or die "cannot copy `$sourcePath' to `$storePath'";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
else { die; }
|
|
||||||
@@ -1,50 +1,85 @@
|
|||||||
#! @perl@ -w -I@libexecdir@/nix
|
#! @perl@ -w -I@libexecdir@/nix
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use NixManifest;
|
use readmanifest;
|
||||||
use POSIX qw(strftime);
|
|
||||||
use File::Temp qw(tempdir);
|
|
||||||
|
|
||||||
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
my $manifestDir = "@localstatedir@/nix/manifests";
|
||||||
|
|
||||||
STDOUT->autoflush(1);
|
|
||||||
|
|
||||||
my $manifestDir = ($ENV{"NIX_MANIFESTS_DIR"} or "@localstatedir@/nix/manifests");
|
|
||||||
my $logFile = "@localstatedir@/log/nix/downloads";
|
my $logFile = "@localstatedir@/log/nix/downloads";
|
||||||
|
|
||||||
# For queries, skip expensive calls to nix-hash etc. We're just
|
open LOGFILE, ">>$logFile" or die "cannot open log file $logFile";
|
||||||
# estimating the expected download size.
|
|
||||||
my $fast = 1;
|
|
||||||
|
# Check the arguments.
|
||||||
|
die unless scalar @ARGV == 1;
|
||||||
|
my $targetPath = $ARGV[0];
|
||||||
|
|
||||||
|
my $date = `date` or die;
|
||||||
|
chomp $date;
|
||||||
|
print LOGFILE "$$ get $targetPath $date\n";
|
||||||
|
|
||||||
|
print "\n*** Trying to download/patch `$targetPath'\n";
|
||||||
|
|
||||||
|
|
||||||
# Load all manifests.
|
# Load all manifests.
|
||||||
my %narFiles;
|
my %narFiles;
|
||||||
my %localPaths;
|
|
||||||
my %patches;
|
my %patches;
|
||||||
|
my %successors;
|
||||||
|
|
||||||
for my $manifest (glob "$manifestDir/*.nixmanifest") {
|
for my $manifest (glob "$manifestDir/*.nixmanifest") {
|
||||||
my $version = readManifest($manifest, \%narFiles, \%localPaths, \%patches);
|
# print STDERR "reading $manifest\n";
|
||||||
if ($version < 3) {
|
if (readManifest($manifest, \%narFiles, \%patches, \%successors) < 3) {
|
||||||
print STDERR "you have an old-style manifest `$manifest'; please delete it\n";
|
print STDERR "you have an old-style manifest `$manifest'; please delete it\n";
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
if ($version >= 10) {
|
|
||||||
print STDERR "manifest `$manifest' is too new; please delete it or upgrade Nix\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Build a graph of all store paths that might contribute to the
|
||||||
|
# construction of $targetPath, and the special node "start". The
|
||||||
|
# edges are either patch operations, or downloads of full NAR files.
|
||||||
|
# The latter edges only occur between "start" and a store path.
|
||||||
|
|
||||||
|
my %graph;
|
||||||
|
|
||||||
|
$graph{"start"} = {d => 0, pred => undef, edges => []};
|
||||||
|
|
||||||
|
my @queue = ();
|
||||||
|
my $queueFront = 0;
|
||||||
|
my %done;
|
||||||
|
|
||||||
|
sub addToQueue {
|
||||||
|
my $v = shift;
|
||||||
|
return if defined $done{$v};
|
||||||
|
$done{$v} = 1;
|
||||||
|
push @queue, $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub addNode {
|
||||||
|
my $u = shift;
|
||||||
|
$graph{$u} = {d => 999999999999, pred => undef, edges => []}
|
||||||
|
unless defined $graph{$u};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub addEdge {
|
||||||
|
my $u = shift;
|
||||||
|
my $v = shift;
|
||||||
|
my $w = shift;
|
||||||
|
my $type = shift;
|
||||||
|
my $info = shift;
|
||||||
|
addNode $u;
|
||||||
|
push @{$graph{$u}->{edges}},
|
||||||
|
{weight => $w, start => $u, end => $v, type => $type, info => $info};
|
||||||
|
my $n = scalar @{$graph{$u}->{edges}};
|
||||||
|
}
|
||||||
|
|
||||||
|
addToQueue $targetPath;
|
||||||
|
|
||||||
sub isValidPath {
|
sub isValidPath {
|
||||||
my $p = shift;
|
my $p = shift;
|
||||||
if ($fast) {
|
system "@bindir@/nix-store --isvalid '$p' 2> /dev/null";
|
||||||
return -e $p;
|
return $? == 0;
|
||||||
} else {
|
|
||||||
return system("$binDir/nix-store --check-validity '$p' 2> /dev/null") == 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub parseHash {
|
sub parseHash {
|
||||||
my $hash = shift;
|
my $hash = shift;
|
||||||
if ($hash =~ /^(.+):(.+)$/) {
|
if ($hash =~ /^(.+):(.+)$/) {
|
||||||
@@ -54,235 +89,97 @@ sub parseHash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while ($queueFront < scalar @queue) {
|
||||||
|
my $u = $queue[$queueFront++];
|
||||||
|
# print "$u\n";
|
||||||
|
|
||||||
# Compute the most efficient sequence of downloads to produce the
|
addNode $u;
|
||||||
# given path.
|
|
||||||
sub computeSmallestDownload {
|
|
||||||
my $targetPath = shift;
|
|
||||||
|
|
||||||
# Build a graph of all store paths that might contribute to the
|
|
||||||
# construction of $targetPath, and the special node "start". The
|
|
||||||
# edges are either patch operations, or downloads of full NAR
|
|
||||||
# files. The latter edges only occur between "start" and a store
|
|
||||||
# path.
|
|
||||||
my %graph;
|
|
||||||
|
|
||||||
$graph{"start"} = {d => 0, pred => undef, edges => []};
|
# If the path already exists, it has distance 0 from the "start"
|
||||||
|
# node.
|
||||||
my @queue = ();
|
if (isValidPath($u)) {
|
||||||
my $queueFront = 0;
|
addEdge "start", $u, 0, "present", undef;
|
||||||
my %done;
|
|
||||||
|
|
||||||
sub addNode {
|
|
||||||
my $graph = shift;
|
|
||||||
my $u = shift;
|
|
||||||
$$graph{$u} = {d => 999999999999, pred => undef, edges => []}
|
|
||||||
unless defined $$graph{$u};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub addEdge {
|
else {
|
||||||
my $graph = shift;
|
|
||||||
my $u = shift;
|
|
||||||
my $v = shift;
|
|
||||||
my $w = shift;
|
|
||||||
my $type = shift;
|
|
||||||
my $info = shift;
|
|
||||||
addNode $graph, $u;
|
|
||||||
push @{$$graph{$u}->{edges}},
|
|
||||||
{weight => $w, start => $u, end => $v, type => $type, info => $info};
|
|
||||||
my $n = scalar @{$$graph{$u}->{edges}};
|
|
||||||
}
|
|
||||||
|
|
||||||
push @queue, $targetPath;
|
# Add patch edges.
|
||||||
|
my $patchList = $patches{$u};
|
||||||
while ($queueFront < scalar @queue) {
|
foreach my $patch (@{$patchList}) {
|
||||||
my $u = $queue[$queueFront++];
|
if (isValidPath($patch->{basePath})) {
|
||||||
next if defined $done{$u};
|
# !!! this should be cached
|
||||||
$done{$u} = 1;
|
my ($baseHashAlgo, $baseHash) = parseHash $patch->{baseHash};
|
||||||
|
my $format = "--base32";
|
||||||
addNode \%graph, $u;
|
$format = "" if $baseHashAlgo eq "md5";
|
||||||
|
my $hash = `@bindir@/nix-hash --type '$baseHashAlgo' $format "$patch->{basePath}"`;
|
||||||
# If the path already exists, it has distance 0 from the
|
chomp $hash;
|
||||||
# "start" node.
|
# print " MY HASH is $hash\n";
|
||||||
if (isValidPath($u)) {
|
if ($hash ne $baseHash) {
|
||||||
addEdge \%graph, "start", $u, 0, "present", undef;
|
print LOGFILE "$$ rejecting $patch->{basePath}\n";
|
||||||
}
|
next;
|
||||||
|
|
||||||
else {
|
|
||||||
|
|
||||||
# Add patch edges.
|
|
||||||
my $patchList = $patches{$u};
|
|
||||||
foreach my $patch (@{$patchList}) {
|
|
||||||
if (isValidPath($patch->{basePath})) {
|
|
||||||
# !!! this should be cached
|
|
||||||
my ($baseHashAlgo, $baseHash) = parseHash $patch->{baseHash};
|
|
||||||
my $format = "--base32";
|
|
||||||
$format = "" if $baseHashAlgo eq "md5";
|
|
||||||
my $hash = $fast && $baseHashAlgo eq "sha256"
|
|
||||||
? `$binDir/nix-store -q --hash "$patch->{basePath}"`
|
|
||||||
: `$binDir/nix-hash --type '$baseHashAlgo' $format "$patch->{basePath}"`;
|
|
||||||
chomp $hash;
|
|
||||||
$hash =~ s/.*://;
|
|
||||||
next if $hash ne $baseHash;
|
|
||||||
}
|
|
||||||
push @queue, $patch->{basePath};
|
|
||||||
addEdge \%graph, $patch->{basePath}, $u, $patch->{size}, "patch", $patch;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add NAR file edges to the start node.
|
|
||||||
my $narFileList = $narFiles{$u};
|
|
||||||
foreach my $narFile (@{$narFileList}) {
|
|
||||||
# !!! how to handle files whose size is not known in advance?
|
|
||||||
# For now, assume some arbitrary size (1 MB).
|
|
||||||
addEdge \%graph, "start", $u, ($narFile->{size} || 1000000), "narfile", $narFile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Run Dijkstra's shortest path algorithm to determine the shortest
|
|
||||||
# sequence of download and/or patch actions that will produce
|
|
||||||
# $targetPath.
|
|
||||||
|
|
||||||
my @todo = keys %graph;
|
|
||||||
|
|
||||||
while (scalar @todo > 0) {
|
|
||||||
|
|
||||||
# Remove the closest element from the todo list.
|
|
||||||
# !!! inefficient, use a priority queue
|
|
||||||
@todo = sort { -($graph{$a}->{d} <=> $graph{$b}->{d}) } @todo;
|
|
||||||
my $u = pop @todo;
|
|
||||||
|
|
||||||
my $u_ = $graph{$u};
|
|
||||||
|
|
||||||
foreach my $edge (@{$u_->{edges}}) {
|
|
||||||
my $v_ = $graph{$edge->{end}};
|
|
||||||
if ($v_->{d} > $u_->{d} + $edge->{weight}) {
|
|
||||||
$v_->{d} = $u_->{d} + $edge->{weight};
|
|
||||||
# Store the edge; to edge->start is actually the
|
|
||||||
# predecessor.
|
|
||||||
$v_->{pred} = $edge;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Retrieve the shortest path from "start" to $targetPath.
|
|
||||||
my @path = ();
|
|
||||||
my $cur = $targetPath;
|
|
||||||
return () unless defined $graph{$targetPath}->{pred};
|
|
||||||
while ($cur ne "start") {
|
|
||||||
push @path, $graph{$cur}->{pred};
|
|
||||||
$cur = $graph{$cur}->{pred}->{start};
|
|
||||||
}
|
|
||||||
|
|
||||||
return @path;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Parse the arguments.
|
|
||||||
|
|
||||||
if ($ARGV[0] eq "--query") {
|
|
||||||
|
|
||||||
while (<STDIN>) {
|
|
||||||
my $cmd = $_; chomp $cmd;
|
|
||||||
|
|
||||||
if ($cmd eq "have") {
|
|
||||||
my $storePath = <STDIN>; chomp $storePath;
|
|
||||||
print STDOUT ((defined $narFiles{$storePath} or defined $localPaths{$storePath})
|
|
||||||
? "1\n" : "0\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($cmd eq "info") {
|
|
||||||
my $storePath = <STDIN>; chomp $storePath;
|
|
||||||
|
|
||||||
my $info;
|
|
||||||
if (defined $narFiles{$storePath}) {
|
|
||||||
$info = @{$narFiles{$storePath}}[0];
|
|
||||||
}
|
|
||||||
elsif (defined $localPaths{$storePath}) {
|
|
||||||
$info = @{$localPaths{$storePath}}[0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
print "0\n";
|
|
||||||
next; # not an error
|
|
||||||
}
|
|
||||||
|
|
||||||
print "1\n";
|
|
||||||
print "$info->{deriver}\n";
|
|
||||||
my @references = split " ", $info->{references};
|
|
||||||
print scalar @references, "\n";
|
|
||||||
print "$_\n" foreach @references;
|
|
||||||
|
|
||||||
my @path = computeSmallestDownload $storePath;
|
|
||||||
|
|
||||||
my $downloadSize = 0;
|
|
||||||
while (scalar @path > 0) {
|
|
||||||
my $edge = pop @path;
|
|
||||||
my $u = $edge->{start};
|
|
||||||
my $v = $edge->{end};
|
|
||||||
if ($edge->{type} eq "patch") {
|
|
||||||
$downloadSize += $edge->{info}->{size} || 0;
|
|
||||||
}
|
|
||||||
elsif ($edge->{type} eq "narfile") {
|
|
||||||
$downloadSize += $edge->{info}->{size} || 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
# print " PATCH from $patch->{basePath}\n";
|
||||||
print "$downloadSize\n";
|
addToQueue $patch->{basePath};
|
||||||
|
addEdge $patch->{basePath}, $u, $patch->{size}, "patch", $patch;
|
||||||
my $narSize = $info->{narSize} || 0;
|
|
||||||
print "$narSize\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else { die "unknown command `$cmd'"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
exit 0;
|
# Add NAR file edges to the start node.
|
||||||
}
|
my $narFileList = $narFiles{$u};
|
||||||
|
foreach my $narFile (@{$narFileList}) {
|
||||||
|
# print " NAR from $narFile->{url}\n";
|
||||||
|
addEdge "start", $u, $narFile->{size}, "narfile", $narFile;
|
||||||
|
if ($u eq $targetPath) {
|
||||||
|
print LOGFILE "$$ full-download-would-be $narFile->{size}\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
elsif ($ARGV[0] ne "--substitute") {
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
die unless scalar @ARGV == 2;
|
|
||||||
my $targetPath = $ARGV[1];
|
|
||||||
$fast = 0;
|
|
||||||
|
|
||||||
|
|
||||||
# Create a temporary directory.
|
|
||||||
my $tmpDir = tempdir("nix-download.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
|
||||||
or die "cannot create a temporary directory";
|
|
||||||
|
|
||||||
my $tmpNar = "$tmpDir/nar";
|
|
||||||
my $tmpNar2 = "$tmpDir/nar2";
|
|
||||||
|
|
||||||
|
|
||||||
open LOGFILE, ">>$logFile" or die "cannot open log file $logFile";
|
|
||||||
|
|
||||||
my $date = strftime ("%F %H:%M:%S UTC", gmtime (time));
|
|
||||||
print LOGFILE "$$ get $targetPath $date\n";
|
|
||||||
|
|
||||||
print "\n*** Trying to download/patch `$targetPath'\n";
|
|
||||||
|
|
||||||
|
|
||||||
# If we can copy from a local path, do that.
|
|
||||||
my $localPathList = $localPaths{$targetPath};
|
|
||||||
foreach my $localPath (@{$localPathList}) {
|
|
||||||
my $sourcePath = $localPath->{copyFrom};
|
|
||||||
if (-e $sourcePath) {
|
|
||||||
print "\n*** Step 1/1: copying from $sourcePath\n";
|
|
||||||
system("$binDir/nix-store --dump $sourcePath | $binDir/nix-store --restore $targetPath") == 0
|
|
||||||
or die "cannot copy `$sourcePath' to `$targetPath'";
|
|
||||||
exit 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Compute the shortest path.
|
# Run Dijkstra's shortest path algorithm to determine the shortest
|
||||||
my @path = computeSmallestDownload $targetPath;
|
# sequence of download and/or patch actions that will produce
|
||||||
die "don't know how to produce $targetPath\n" if scalar @path == 0;
|
# $targetPath.
|
||||||
|
|
||||||
|
sub byDistance { # sort by distance, reversed
|
||||||
|
return -($graph{$a}->{d} <=> $graph{$b}->{d});
|
||||||
|
}
|
||||||
|
|
||||||
|
my @todo = keys %graph;
|
||||||
|
|
||||||
|
while (scalar @todo > 0) {
|
||||||
|
|
||||||
|
# Remove the closest element from the todo list.
|
||||||
|
@todo = sort byDistance @todo;
|
||||||
|
my $u = pop @todo;
|
||||||
|
|
||||||
|
my $u_ = $graph{$u};
|
||||||
|
|
||||||
|
# print "IN $u $u_->{d}\n";
|
||||||
|
|
||||||
|
foreach my $edge (@{$u_->{edges}}) {
|
||||||
|
my $v_ = $graph{$edge->{end}};
|
||||||
|
if ($v_->{d} > $u_->{d} + $edge->{weight}) {
|
||||||
|
$v_->{d} = $u_->{d} + $edge->{weight};
|
||||||
|
# Store the edge; to edge->start is actually the
|
||||||
|
# predecessor.
|
||||||
|
$v_->{pred} = $edge;
|
||||||
|
# print " RELAX $edge->{end} $v_->{d}\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Retrieve the shortest path from "start" to $targetPath.
|
||||||
|
my @path = ();
|
||||||
|
my $cur = $targetPath;
|
||||||
|
die "don't know how to produce $targetPath\n"
|
||||||
|
unless defined $graph{$targetPath}->{pred};
|
||||||
|
while ($cur ne "start") {
|
||||||
|
push @path, $graph{$cur}->{pred};
|
||||||
|
$cur = $graph{$cur}->{pred}->{start};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Traverse the shortest path, perform the actions described by the
|
# Traverse the shortest path, perform the actions described by the
|
||||||
@@ -290,37 +187,31 @@ die "don't know how to produce $targetPath\n" if scalar @path == 0;
|
|||||||
my $curStep = 1;
|
my $curStep = 1;
|
||||||
my $maxStep = scalar @path;
|
my $maxStep = scalar @path;
|
||||||
|
|
||||||
sub downloadFile {
|
sub downloadFile {
|
||||||
my $url = shift;
|
my $url = shift;
|
||||||
|
my ($hashAlgo, $hash) = parseHash(shift);
|
||||||
$ENV{"PRINT_PATH"} = 1;
|
$ENV{"PRINT_PATH"} = 1;
|
||||||
$ENV{"QUIET"} = 1;
|
$ENV{"QUIET"} = 1;
|
||||||
my ($hash, $path) = `$binDir/nix-prefetch-url '$url'`;
|
$ENV{"NIX_HASH_ALGO"} = $hashAlgo;
|
||||||
|
my ($hash2, $path) = `@bindir@/nix-prefetch-url '$url' '$hash'`;
|
||||||
die "download of `$url' failed" unless $? == 0;
|
die "download of `$url' failed" unless $? == 0;
|
||||||
|
chomp $hash2;
|
||||||
chomp $path;
|
chomp $path;
|
||||||
|
die "hash mismatch, expected $hash, got $hash2" if $hash ne $hash2;
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $finalNarHash;
|
|
||||||
|
|
||||||
while (scalar @path > 0) {
|
while (scalar @path > 0) {
|
||||||
my $edge = pop @path;
|
my $edge = pop @path;
|
||||||
my $u = $edge->{start};
|
my $u = $edge->{start};
|
||||||
my $v = $edge->{end};
|
my $v = $edge->{end};
|
||||||
|
|
||||||
print "\n*** Step $curStep/$maxStep: ";
|
print "\n*** Step $curStep/$maxStep: ";
|
||||||
|
$curStep++;
|
||||||
|
|
||||||
if ($edge->{type} eq "present") {
|
if ($edge->{type} eq "present") {
|
||||||
print "using already present path `$v'\n";
|
print "using already present path `$v'\n";
|
||||||
print LOGFILE "$$ present $v\n";
|
print LOGFILE "$$ present $v\n";
|
||||||
|
|
||||||
if ($curStep < $maxStep) {
|
|
||||||
# Since this is not the last step, the path will be used
|
|
||||||
# as a base to one or more patches. So turn the base path
|
|
||||||
# into a NAR archive, to which we can apply the patch.
|
|
||||||
print " packing base path...\n";
|
|
||||||
system("$binDir/nix-store --dump $v > $tmpNar") == 0
|
|
||||||
or die "cannot dump `$v'";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($edge->{type} eq "patch") {
|
elsif ($edge->{type} eq "patch") {
|
||||||
@@ -331,77 +222,40 @@ while (scalar @path > 0) {
|
|||||||
|
|
||||||
# Download the patch.
|
# Download the patch.
|
||||||
print " downloading patch...\n";
|
print " downloading patch...\n";
|
||||||
my $patchPath = downloadFile "$patch->{url}";
|
my $patchPath = downloadFile "$patch->{url}", "$patch->{hash}";
|
||||||
|
|
||||||
# Apply the patch to the NAR archive produced in step 1 (for
|
# Turn the base path into a NAR archive, to which we can
|
||||||
# the already present path) or a later step (for patch sequences).
|
# actually apply the patch.
|
||||||
|
print " packing base path...\n";
|
||||||
|
system "@bindir@/nix-store --dump $patch->{basePath} > /tmp/nar";
|
||||||
|
die "cannot dump `$patch->{basePath}'" if ($? != 0);
|
||||||
|
|
||||||
|
# Apply the patch.
|
||||||
print " applying patch...\n";
|
print " applying patch...\n";
|
||||||
system("@libexecdir@/bspatch $tmpNar $tmpNar2 $patchPath") == 0
|
system "@libexecdir@/bspatch /tmp/nar /tmp/nar2 $patchPath";
|
||||||
or die "cannot apply patch `$patchPath' to $tmpNar";
|
die "cannot apply patch `$patchPath' to /tmp/nar" if ($? != 0);
|
||||||
|
|
||||||
if ($curStep < $maxStep) {
|
# Unpack the resulting NAR archive into the target path.
|
||||||
# The archive will be used as the base of the next patch.
|
print " unpacking patched archive...\n";
|
||||||
rename "$tmpNar2", "$tmpNar" or die "cannot rename NAR archive: $!";
|
system "@bindir@/nix-store --restore $v < /tmp/nar2";
|
||||||
} else {
|
die "cannot unpack /tmp/nar2 into `$v'" if ($? != 0);
|
||||||
# This was the last patch. Unpack the final NAR archive
|
|
||||||
# into the target path.
|
|
||||||
print " unpacking patched archive...\n";
|
|
||||||
system("$binDir/nix-store --restore $v < $tmpNar2") == 0
|
|
||||||
or die "cannot unpack $tmpNar2 into `$v'";
|
|
||||||
}
|
|
||||||
|
|
||||||
$finalNarHash = $patch->{narHash};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($edge->{type} eq "narfile") {
|
elsif ($edge->{type} eq "narfile") {
|
||||||
my $narFile = $edge->{info};
|
my $narFile = $edge->{info};
|
||||||
print "downloading `$narFile->{url}' into `$v'\n";
|
print "downloading `$narFile->{url}' into `$v'\n";
|
||||||
|
|
||||||
my $size = $narFile->{size} || -1;
|
print LOGFILE "$$ narfile $narFile->{url} $narFile->{size} $v\n";
|
||||||
print LOGFILE "$$ narfile $narFile->{url} $size $v\n";
|
|
||||||
|
|
||||||
# Download the archive.
|
# Download the archive.
|
||||||
print " downloading archive...\n";
|
print " downloading archive...\n";
|
||||||
my $narFilePath = downloadFile "$narFile->{url}";
|
my $narFilePath = downloadFile "$narFile->{url}", "$narFile->{hash}";
|
||||||
|
|
||||||
if ($curStep < $maxStep) {
|
# Unpack the archive into the target path.
|
||||||
# The archive will be used a base to a patch.
|
print " unpacking archive...\n";
|
||||||
system("@bunzip2@ < '$narFilePath' > $tmpNar") == 0
|
system "@bunzip2@ < '$narFilePath' | @bindir@/nix-store --restore '$v'";
|
||||||
or die "cannot unpack `$narFilePath' into `$v'";
|
die "cannot unpack `$narFilePath' into `$v'" if ($? != 0);
|
||||||
} else {
|
|
||||||
# Unpack the archive into the target path.
|
|
||||||
print " unpacking archive...\n";
|
|
||||||
system("@bunzip2@ < '$narFilePath' | $binDir/nix-store --restore '$v'") == 0
|
|
||||||
or die "cannot unpack `$narFilePath' into `$v'";
|
|
||||||
}
|
|
||||||
|
|
||||||
$finalNarHash = $narFile->{narHash};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$curStep++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Make sure that the hash declared in the manifest matches what we
|
|
||||||
# downloaded and unpacked.
|
|
||||||
|
|
||||||
if (defined $finalNarHash) {
|
|
||||||
my ($hashAlgo, $hash) = parseHash $finalNarHash;
|
|
||||||
|
|
||||||
# The hash in the manifest can be either in base-16 or base-32.
|
|
||||||
# Handle both.
|
|
||||||
my $extraFlag =
|
|
||||||
($hashAlgo eq "sha256" && length($hash) != 64)
|
|
||||||
? "--base32" : "";
|
|
||||||
|
|
||||||
my $hash2 = `@bindir@/nix-hash --type $hashAlgo $extraFlag $targetPath`
|
|
||||||
or die "cannot compute hash of path `$targetPath'";
|
|
||||||
chomp $hash2;
|
|
||||||
|
|
||||||
die "hash mismatch in downloaded path $targetPath; expected $hash, got $hash2"
|
|
||||||
if $hash ne $hash2;
|
|
||||||
} else {
|
|
||||||
die "cannot check integrity of the downloaded path since its hash is not known";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
#! @perl@ -w
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
my $procDir = "/proc";
|
|
||||||
|
|
||||||
|
|
||||||
sub readProc {
|
|
||||||
return unless -d $procDir;
|
|
||||||
|
|
||||||
opendir DIR, $procDir or return;
|
|
||||||
|
|
||||||
foreach my $name (readdir DIR) {
|
|
||||||
next unless $name =~ /^\d+$/;
|
|
||||||
|
|
||||||
my $process = "$procDir/$name";
|
|
||||||
|
|
||||||
#print STDERR "=== $process\n";
|
|
||||||
|
|
||||||
my $target;
|
|
||||||
print "$target\n" if $target = readlink "$process/exe";
|
|
||||||
print "$target\n" if $target = readlink "$process/cwd";
|
|
||||||
|
|
||||||
if (opendir FDS, "$process/fd") {
|
|
||||||
foreach my $name (readdir FDS) {
|
|
||||||
$target = readlink "$process/fd/$name";
|
|
||||||
print "$target\n" if $target && substr($target, 0, 1) eq "/";
|
|
||||||
}
|
|
||||||
closedir FDS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (open MAP, "<$process/maps") {
|
|
||||||
while (<MAP>) {
|
|
||||||
next unless /^ \s* \S+ \s+ \S+ \s+ \S+ \s+ \S+ \s+ \S+ \s+ (\/\S+) \s* $/x;
|
|
||||||
print "$1\n";
|
|
||||||
}
|
|
||||||
close MAP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir DIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub lsof {
|
|
||||||
return unless open LSOF, "lsof -n -w -F n 2> /dev/null |";
|
|
||||||
|
|
||||||
while (<LSOF>) {
|
|
||||||
next unless /^n (\/ .*)$/x;
|
|
||||||
print $1, "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
close LSOF;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
readProc;
|
|
||||||
lsof;
|
|
||||||
|
|
||||||
|
|
||||||
sub readFile {
|
|
||||||
my $path = shift;
|
|
||||||
if (-e $path) {
|
|
||||||
if (open FILE, "$path") {
|
|
||||||
while (<FILE>) {
|
|
||||||
print;
|
|
||||||
}
|
|
||||||
close FILE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# This is rather NixOS-specific, so it probably shouldn't be here.
|
|
||||||
readFile "/proc/sys/kernel/modprobe";
|
|
||||||
readFile "/proc/sys/kernel/fbsplash";
|
|
||||||
@@ -1,18 +1,38 @@
|
|||||||
#! /usr/bin/perl -w -I. -I..
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use readmanifest;
|
use readmanifest;
|
||||||
use readcache;
|
|
||||||
|
|
||||||
|
# Read the archive directories.
|
||||||
|
my @archives = ();
|
||||||
|
my %archives;
|
||||||
|
|
||||||
|
sub readDir {
|
||||||
|
my $dir = shift;
|
||||||
|
opendir(DIR, "$dir") or die "cannot open `$dir': $!";
|
||||||
|
my @as = readdir DIR;
|
||||||
|
foreach my $archive (@as) {
|
||||||
|
push @archives, $archive;
|
||||||
|
$archives{$archive} = "$dir/$archive";
|
||||||
|
}
|
||||||
|
closedir DIR;
|
||||||
|
}
|
||||||
|
|
||||||
|
readDir "/mnt/scratchy/eelco/public_html/nix-cache";
|
||||||
|
readDir "/mnt/scratchy/eelco/public_html/patches";
|
||||||
|
|
||||||
|
print STDERR scalar @archives, "\n";
|
||||||
|
|
||||||
|
|
||||||
# Read the manifests.
|
# Read the manifests.
|
||||||
my %narFiles;
|
my %narFiles;
|
||||||
my %localPaths;
|
|
||||||
my %patches;
|
my %patches;
|
||||||
|
my %successors;
|
||||||
|
|
||||||
foreach my $manifest (@ARGV) {
|
foreach my $manifest (@ARGV) {
|
||||||
print STDERR "loading $manifest\n";
|
print STDERR "loading $manifest\n";
|
||||||
if (readManifest($manifest, \%narFiles, \%localPaths, \%patches, 1) < 3) {
|
if (readManifest($manifest, \%narFiles, \%patches, \%successors, 1) < 3) {
|
||||||
# die "manifest `$manifest' is too old (i.e., for Nix <= 0.7)\n";
|
# die "manifest `$manifest' is too old (i.e., for Nix <= 0.7)\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,8 +48,8 @@ foreach my $narFile (keys %narFiles) {
|
|||||||
die unless defined $basename;
|
die unless defined $basename;
|
||||||
# print $basename, "\n";
|
# print $basename, "\n";
|
||||||
$usedFiles{$basename} = 1;
|
$usedFiles{$basename} = 1;
|
||||||
print STDERR "missing archive `$basename'\n"
|
die "missing archive `$basename'"
|
||||||
unless defined $readcache::archives{$basename};
|
unless defined $archives{$basename};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,15 +61,15 @@ foreach my $patch (keys %patches) {
|
|||||||
# print $basename, "\n";
|
# print $basename, "\n";
|
||||||
$usedFiles{$basename} = 1;
|
$usedFiles{$basename} = 1;
|
||||||
die "missing archive `$basename'"
|
die "missing archive `$basename'"
|
||||||
unless defined $readcache::archives{$basename};
|
unless defined $archives{$basename};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Print out the dead archives.
|
# Print out the dead archives.
|
||||||
foreach my $archive (keys %readcache::archives) {
|
foreach my $archive (@archives) {
|
||||||
next if $archive eq "." || $archive eq "..";
|
next if $archive eq "." || $archive eq "..";
|
||||||
if (!defined $usedFiles{$archive}) {
|
if (!defined $usedFiles{$archive}) {
|
||||||
print $readcache::archives{$archive}, "\n";
|
print $archives{$archive}, "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Executable
+376
@@ -0,0 +1,376 @@
|
|||||||
|
#! @perl@ -w -I@libexecdir@/nix
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use POSIX qw(tmpnam);
|
||||||
|
use readmanifest;
|
||||||
|
|
||||||
|
die unless scalar @ARGV == 5;
|
||||||
|
|
||||||
|
my $hashAlgo = "sha256";
|
||||||
|
|
||||||
|
my $cacheDir = $ARGV[0];
|
||||||
|
my $patchesDir = $ARGV[1];
|
||||||
|
my $patchesURL = $ARGV[2];
|
||||||
|
my $srcDir = $ARGV[3];
|
||||||
|
my $dstDir = $ARGV[4];
|
||||||
|
|
||||||
|
my $tmpdir;
|
||||||
|
do { $tmpdir = tmpnam(); }
|
||||||
|
until mkdir $tmpdir, 0777;
|
||||||
|
|
||||||
|
print "TEMP = $tmpdir\n";
|
||||||
|
|
||||||
|
#END { rmdir $tmpdir; }
|
||||||
|
|
||||||
|
my %srcNarFiles;
|
||||||
|
my %srcPatches;
|
||||||
|
my %srcSuccessors;
|
||||||
|
|
||||||
|
my %dstNarFiles;
|
||||||
|
my %dstPatches;
|
||||||
|
my %dstSuccessors;
|
||||||
|
|
||||||
|
readManifest "$srcDir/MANIFEST",
|
||||||
|
\%srcNarFiles, \%srcPatches, \%srcSuccessors;
|
||||||
|
|
||||||
|
readManifest "$dstDir/MANIFEST",
|
||||||
|
\%dstNarFiles, \%dstPatches, \%dstSuccessors;
|
||||||
|
|
||||||
|
|
||||||
|
sub findOutputPaths {
|
||||||
|
my $narFiles = shift;
|
||||||
|
my $successors = shift;
|
||||||
|
|
||||||
|
my %outPaths;
|
||||||
|
|
||||||
|
foreach my $p (keys %{$narFiles}) {
|
||||||
|
|
||||||
|
# Ignore store expressions.
|
||||||
|
next if ($p =~ /\.store$/);
|
||||||
|
next if ($p =~ /\.drv$/);
|
||||||
|
|
||||||
|
# Ignore builders (too much ambiguity -- they're all called
|
||||||
|
# `builder.sh').
|
||||||
|
next if ($p =~ /\.sh$/);
|
||||||
|
next if ($p =~ /\.patch$/);
|
||||||
|
|
||||||
|
# Don't bother including tar files etc.
|
||||||
|
next if ($p =~ /\.tar\.(gz|bz2)$/ || $p =~ /\.zip$/ || $p =~ /\.bin$/);
|
||||||
|
|
||||||
|
$outPaths{$p} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return %outPaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "finding src output paths...\n";
|
||||||
|
my %srcOutPaths = findOutputPaths \%srcNarFiles, \%srcSuccessors;
|
||||||
|
|
||||||
|
print "finding dst output paths...\n";
|
||||||
|
my %dstOutPaths = findOutputPaths \%dstNarFiles, \%dstSuccessors;
|
||||||
|
|
||||||
|
|
||||||
|
sub getNameVersion {
|
||||||
|
my $p = shift;
|
||||||
|
$p =~ /\/[0-9a-z]+((?:-[a-zA-Z][^\/-]*)+)([^\/]*)$/;
|
||||||
|
my $name = $1;
|
||||||
|
my $version = $2;
|
||||||
|
$name =~ s/^-//;
|
||||||
|
$version =~ s/^-//;
|
||||||
|
return ($name, $version);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# A quick hack to get a measure of the `distance' between two
|
||||||
|
# versions: it's just the position of the first character that differs
|
||||||
|
# (or 999 if they are the same).
|
||||||
|
sub versionDiff {
|
||||||
|
my $s = shift;
|
||||||
|
my $t = shift;
|
||||||
|
my $i;
|
||||||
|
return 999 if $s eq $t;
|
||||||
|
for ($i = 0; $i < length $s; $i++) {
|
||||||
|
return $i if $i >= length $t or
|
||||||
|
substr($s, $i, 1) ne substr($t, $i, 1);
|
||||||
|
}
|
||||||
|
return $i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub getNarBz2 {
|
||||||
|
my $narFiles = shift;
|
||||||
|
my $storePath = shift;
|
||||||
|
|
||||||
|
my $narFileList = $$narFiles{$storePath};
|
||||||
|
die "missing store expression $storePath" unless defined $narFileList;
|
||||||
|
|
||||||
|
my $narFile = @{$narFileList}[0];
|
||||||
|
die unless defined $narFile;
|
||||||
|
|
||||||
|
$narFile->{url} =~ /\/([^\/]+)$/;
|
||||||
|
die unless defined $1;
|
||||||
|
return "$cacheDir/$1";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub containsPatch {
|
||||||
|
my $patches = shift;
|
||||||
|
my $storePath = shift;
|
||||||
|
my $basePath = shift;
|
||||||
|
my $patchList = $$patches{$storePath};
|
||||||
|
return 0 if !defined $patchList;
|
||||||
|
my $found = 0;
|
||||||
|
foreach my $patch (@{$patchList}) {
|
||||||
|
# !!! baseHash might differ
|
||||||
|
return 1 if $patch->{basePath} eq $basePath;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Compute the "weighted" number of uses of a path in the build graph.
|
||||||
|
sub computeUses {
|
||||||
|
my $narFiles = shift;
|
||||||
|
my $path = shift;
|
||||||
|
|
||||||
|
# Find the deriver of $path.
|
||||||
|
return 1 unless defined $$narFiles{$path};
|
||||||
|
my $deriver = @{$$narFiles{$path}}[0]->{deriver};
|
||||||
|
return 1 unless defined $deriver && $deriver ne "";
|
||||||
|
|
||||||
|
# print " DERIVER $deriver\n";
|
||||||
|
|
||||||
|
# Optimisation: build the referers graph from the references
|
||||||
|
# graph.
|
||||||
|
my %referers;
|
||||||
|
foreach my $q (keys %{$narFiles}) {
|
||||||
|
my @refs = split " ", @{$$narFiles{$q}}[0]->{references};
|
||||||
|
foreach my $r (@refs) {
|
||||||
|
$referers{$r} = [] unless defined $referers{$r};
|
||||||
|
push @{$referers{$r}}, $q;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Determine the shortest path from $deriver to all other reachable
|
||||||
|
# paths in the `referers' graph.
|
||||||
|
|
||||||
|
my %dist;
|
||||||
|
$dist{$deriver} = 0;
|
||||||
|
|
||||||
|
my @queue = ($deriver);
|
||||||
|
my $pos = 0;
|
||||||
|
|
||||||
|
while ($pos < scalar @queue) {
|
||||||
|
my $p = $queue[$pos];
|
||||||
|
$pos++;
|
||||||
|
|
||||||
|
foreach my $q (@{$referers{$p}}) {
|
||||||
|
if (!defined $dist{$q}) {
|
||||||
|
$dist{$q} = $dist{$p} + 1;
|
||||||
|
# print " $q $dist{$q}\n";
|
||||||
|
push @queue, $q;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $wuse = 1.0;
|
||||||
|
foreach my $user (keys %dist) {
|
||||||
|
next if $user eq $deriver;
|
||||||
|
# print " $user $dist{$user}\n";
|
||||||
|
$wuse += 1.0 / 2.0**$dist{$user};
|
||||||
|
}
|
||||||
|
|
||||||
|
# print " XXX $path $wuse\n";
|
||||||
|
|
||||||
|
return $wuse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# For each output path in the destination, see if we need to / can
|
||||||
|
# create a patch.
|
||||||
|
|
||||||
|
print "creating patches...\n";
|
||||||
|
|
||||||
|
foreach my $p (keys %dstOutPaths) {
|
||||||
|
|
||||||
|
# If exactly the same path already exists in the source, skip it.
|
||||||
|
next if defined $srcOutPaths{$p};
|
||||||
|
|
||||||
|
print " $p\n";
|
||||||
|
|
||||||
|
# If not, then we should find the paths in the source that are
|
||||||
|
# `most' likely to be present on a system that wants to install
|
||||||
|
# this path.
|
||||||
|
|
||||||
|
(my $name, my $version) = getNameVersion $p;
|
||||||
|
|
||||||
|
my @closest = ();
|
||||||
|
my $closestVersion;
|
||||||
|
my $minDist = -1; # actually, larger means closer
|
||||||
|
|
||||||
|
# Find all source paths with the same name.
|
||||||
|
|
||||||
|
foreach my $q (keys %srcOutPaths) {
|
||||||
|
(my $name2, my $version2) = getNameVersion $q;
|
||||||
|
if ($name eq $name2) {
|
||||||
|
|
||||||
|
# If the sizes differ too much, then skip. This
|
||||||
|
# disambiguates between, e.g., a real component and a
|
||||||
|
# wrapper component (cf. Firefox in Nixpkgs).
|
||||||
|
my $srcSize = @{$srcNarFiles{$q}}[0]->{size};
|
||||||
|
my $dstSize = @{$dstNarFiles{$p}}[0]->{size};
|
||||||
|
my $ratio = $srcSize / $dstSize;
|
||||||
|
$ratio = 1 / $ratio if $ratio < 1;
|
||||||
|
# print " SIZE $srcSize $dstSize $ratio $q\n";
|
||||||
|
|
||||||
|
if ($ratio >= 3) {
|
||||||
|
print " SKIPPING $q due to size ratio $ratio ($srcSize $dstSize)\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
# If the numbers of weighted uses differ too much, then
|
||||||
|
# skip. This disambiguates between, e.g., the bootstrap
|
||||||
|
# GCC and the final GCC in Nixpkgs.
|
||||||
|
my $srcUses = computeUses \%srcNarFiles, $q;
|
||||||
|
my $dstUses = computeUses \%dstNarFiles, $p;
|
||||||
|
$ratio = $srcUses / $dstUses;
|
||||||
|
$ratio = 1 / $ratio if $ratio < 1;
|
||||||
|
print " USE $srcUses $dstUses $ratio $q\n";
|
||||||
|
|
||||||
|
if ($ratio >= 2) {
|
||||||
|
print " SKIPPING $q due to use ratio $ratio ($srcUses $dstUses)\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
# If there are multiple matching names, include the ones
|
||||||
|
# with the closest version numbers.
|
||||||
|
my $dist = versionDiff $version, $version2;
|
||||||
|
if ($dist > $minDist) {
|
||||||
|
$minDist = $dist;
|
||||||
|
@closest = ($q);
|
||||||
|
$closestVersion = $version2;
|
||||||
|
} elsif ($dist == $minDist) {
|
||||||
|
push @closest, $q;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar(@closest) == 0) {
|
||||||
|
print " NO BASE: $p\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $closest (@closest) {
|
||||||
|
|
||||||
|
# Generate a patch between $closest and $p.
|
||||||
|
print " $p <- $closest\n";
|
||||||
|
|
||||||
|
# If the patch already exists, skip it.
|
||||||
|
if (containsPatch(\%srcPatches, $p, $closest) ||
|
||||||
|
containsPatch(\%dstPatches, $p, $closest))
|
||||||
|
{
|
||||||
|
print " skipping, already exists\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
# next;
|
||||||
|
|
||||||
|
my $srcNarBz2 = getNarBz2 \%srcNarFiles, $closest;
|
||||||
|
my $dstNarBz2 = getNarBz2 \%dstNarFiles, $p;
|
||||||
|
|
||||||
|
system("@bunzip2@ < $srcNarBz2 > $tmpdir/A") == 0
|
||||||
|
or die "cannot unpack $srcNarBz2";
|
||||||
|
|
||||||
|
system("@bunzip2@ < $dstNarBz2 > $tmpdir/B") == 0
|
||||||
|
or die "cannot unpack $dstNarBz2";
|
||||||
|
|
||||||
|
system("@libexecdir@/bsdiff $tmpdir/A $tmpdir/B $tmpdir/DIFF") == 0
|
||||||
|
or die "cannot compute binary diff";
|
||||||
|
|
||||||
|
my $baseHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpdir/A` or die;
|
||||||
|
chomp $baseHash;
|
||||||
|
|
||||||
|
my $narHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpdir/B` or die;
|
||||||
|
chomp $narHash;
|
||||||
|
|
||||||
|
my $narDiffHash = `@bindir@/nix-hash --flat --type $hashAlgo --base32 $tmpdir/DIFF` or die;
|
||||||
|
chomp $narDiffHash;
|
||||||
|
|
||||||
|
my $narDiffSize = (stat "$tmpdir/DIFF")[7];
|
||||||
|
my $dstNarBz2Size = (stat $dstNarBz2)[7];
|
||||||
|
|
||||||
|
if ($narDiffSize >= $dstNarBz2Size) {
|
||||||
|
print " rejecting; patch bigger than full archive\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $finalName =
|
||||||
|
"$narDiffHash.nar-bsdiff";
|
||||||
|
|
||||||
|
print " size $narDiffSize; full size $dstNarBz2Size\n";
|
||||||
|
|
||||||
|
if (-e "$patchesDir/$finalName") {
|
||||||
|
print " not copying, already exists\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
|
||||||
|
system("cp '$tmpdir/DIFF' '$patchesDir/$finalName.tmp'") == 0
|
||||||
|
or die "cannot copy diff";
|
||||||
|
|
||||||
|
rename("$patchesDir/$finalName.tmp", "$patchesDir/$finalName")
|
||||||
|
or die "cannot rename $patchesDir/$finalName.tmp";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add the patch to the manifest.
|
||||||
|
addPatch \%dstPatches, $p,
|
||||||
|
{ url => "$patchesURL/$finalName", hash => "$hashAlgo:$narDiffHash"
|
||||||
|
, size => $narDiffSize, basePath => $closest, baseHash => "$hashAlgo:$baseHash"
|
||||||
|
, narHash => "$hashAlgo:$narHash", patchType => "nar-bsdiff"
|
||||||
|
}, 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Add in any potentially useful patches in the source (namely, those
|
||||||
|
# patches that produce either paths in the destination or paths that
|
||||||
|
# can be used as the base for other useful patches).
|
||||||
|
|
||||||
|
my $changed;
|
||||||
|
do {
|
||||||
|
# !!! we repeat this to reach the transitive closure; inefficient
|
||||||
|
$changed = 0;
|
||||||
|
|
||||||
|
foreach my $p (keys %srcPatches) {
|
||||||
|
my $patchList = $srcPatches{$p};
|
||||||
|
|
||||||
|
my $include = 0;
|
||||||
|
|
||||||
|
# Is path $p included in the destination? If so, include
|
||||||
|
# patches that produce it.
|
||||||
|
$include = 1 if (defined $dstNarFiles{$p});
|
||||||
|
|
||||||
|
# Is path $p a path that serves as a base for paths in the
|
||||||
|
# destination? If so, include patches that produce it.
|
||||||
|
foreach my $q (keys %dstPatches) {
|
||||||
|
foreach my $patch (@{$dstPatches{$q}}) {
|
||||||
|
# !!! check baseHash
|
||||||
|
$include = 1 if ($p eq $patch->{basePath});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($include) {
|
||||||
|
foreach my $patch (@{$patchList}) {
|
||||||
|
$changed = 1 if addPatch \%dstPatches, $p, $patch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} while $changed;
|
||||||
|
|
||||||
|
|
||||||
|
# Rewrite the manifest of the destination (with the new patches).
|
||||||
|
writeManifest "$dstDir/MANIFEST",
|
||||||
|
\%dstNarFiles, \%dstPatches, \%dstSuccessors;
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
./gc-releases.pl /data/webserver/dist/*/*/MANIFEST > dead
|
|
||||||
cat dead | xargs mv --target-directory=/data/webserver/trash/
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package readcache;
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
# Read the archive directories.
|
|
||||||
our %archives;
|
|
||||||
|
|
||||||
sub readDir {
|
|
||||||
my $dir = shift;
|
|
||||||
opendir(DIR, "$dir") or die "cannot open `$dir': $!";
|
|
||||||
my @as = readdir DIR;
|
|
||||||
foreach my $archive (@as) {
|
|
||||||
$archives{$archive} = "$dir/$archive";
|
|
||||||
}
|
|
||||||
closedir DIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
readDir "/data/webserver/dist/nix-cache";
|
|
||||||
readDir "/data/webserver/dist/test-cache";
|
|
||||||
readDir "/data/webserver/dist/patches";
|
|
||||||
|
|
||||||
print STDERR scalar (keys %archives), "\n";
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
#! /usr/bin/perl -w -I. -I..
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use readmanifest;
|
|
||||||
use readcache;
|
|
||||||
|
|
||||||
|
|
||||||
my %allNarFiles;
|
|
||||||
my %allLocalPaths;
|
|
||||||
my %allPatches;
|
|
||||||
|
|
||||||
foreach my $manifest (glob "/data/webserver/dist/*/*/MANIFEST") {
|
|
||||||
print STDERR "loading $manifest\n";
|
|
||||||
readManifest($manifest, \%allNarFiles, \%allLocalPaths, \%allPatches, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach my $manifest (@ARGV) {
|
|
||||||
|
|
||||||
print STDERR "shrinking manifest $manifest...\n";
|
|
||||||
|
|
||||||
my %narFiles;
|
|
||||||
my %patches;
|
|
||||||
|
|
||||||
if (readManifest($manifest, \%narFiles, \%patches, 1) < 3) {
|
|
||||||
print STDERR "manifest `$manifest' is too old (i.e., for Nix <= 0.7)\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
my %done;
|
|
||||||
|
|
||||||
sub traverse {
|
|
||||||
my $p = shift;
|
|
||||||
my $prefix = shift;
|
|
||||||
print "$prefix$p\n";
|
|
||||||
|
|
||||||
my $reachesNAR = 0;
|
|
||||||
|
|
||||||
foreach my $patch (@{$patches{$p}}) {
|
|
||||||
next if defined $done{$patch->{url}};
|
|
||||||
$done{$patch->{url}} = 1;
|
|
||||||
$reachesNAR = 1 if traverse ($patch->{basePath}, $prefix . " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
$reachesNAR = 1 if defined $allNarFiles{$p};
|
|
||||||
|
|
||||||
print " $prefix$reachesNAR\n";
|
|
||||||
return $reachesNAR;
|
|
||||||
}
|
|
||||||
|
|
||||||
# foreach my $p (keys %narFiles) {
|
|
||||||
# traverse ($p, "");
|
|
||||||
# }
|
|
||||||
|
|
||||||
my %newPatches;
|
|
||||||
|
|
||||||
foreach my $p (keys %patches) {
|
|
||||||
my $patchList = $patches{$p};
|
|
||||||
my @newList;
|
|
||||||
foreach my $patch (@{$patchList}) {
|
|
||||||
if (! defined $allNarFiles{$patch->{basePath}} ||
|
|
||||||
! defined $allNarFiles{$p} )
|
|
||||||
{
|
|
||||||
# print "REMOVING PATCH ", $patch->{basePath}, " -> ", $p, "\n";
|
|
||||||
} else {
|
|
||||||
# print "KEEPING PATCH ", $patch->{basePath}, " -> ", $p, "\n";
|
|
||||||
push @newList, $patch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$newPatches{$p} = \@newList;
|
|
||||||
}
|
|
||||||
|
|
||||||
writeManifest ($manifest, \%narFiles, \%newPatches);
|
|
||||||
}
|
|
||||||
|
|
||||||
+51
-179
@@ -1,187 +1,59 @@
|
|||||||
#! @perl@ -w -I@libexecdir@/nix
|
#! @shell@ -e
|
||||||
|
|
||||||
use strict;
|
nixExpr=$1
|
||||||
|
|
||||||
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
if test -z "$nixExpr"; then
|
||||||
|
echo "syntax: $0 NIX-EXPR..." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
extraArgs=
|
||||||
|
addDrvLink=0
|
||||||
|
addOutLink=1
|
||||||
|
|
||||||
|
|
||||||
my $addDrvLink = 0;
|
trap 'rm -f ./.nix-build-tmp-*' EXIT
|
||||||
my $addOutLink = 1;
|
|
||||||
|
|
||||||
my $outLink;
|
|
||||||
my $drvLink;
|
|
||||||
|
|
||||||
my $dryRun = 0;
|
|
||||||
my $verbose = 0;
|
|
||||||
|
|
||||||
my @instArgs = ();
|
|
||||||
my @buildArgs = ();
|
|
||||||
my @exprs = ();
|
|
||||||
|
|
||||||
|
|
||||||
END {
|
# Process the arguments.
|
||||||
foreach my $fn (glob ".nix-build-tmp-*") {
|
for i in "$@"; do
|
||||||
unlink $fn;
|
case "$i" in
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub intHandler {
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$SIG{'INT'} = 'intHandler';
|
|
||||||
|
|
||||||
|
|
||||||
for (my $n = 0; $n < scalar @ARGV; $n++) {
|
|
||||||
my $arg = $ARGV[$n];
|
|
||||||
|
|
||||||
if ($arg eq "--help") {
|
|
||||||
print STDERR <<EOF;
|
|
||||||
Usage: nix-build [OPTION]... [FILE]...
|
|
||||||
|
|
||||||
`nix-build' builds the given Nix expressions (which
|
|
||||||
default to ./default.nix if none are given). A symlink called
|
|
||||||
`result' is placed in the current directory.
|
|
||||||
|
|
||||||
Flags:
|
|
||||||
--add-drv-link: create a symlink `derivation' to the store derivation
|
|
||||||
--drv-link NAME: create symlink NAME instead of `derivation'
|
|
||||||
--no-out-link: do not create the `result' symlink
|
|
||||||
--out-link / -o NAME: create symlink NAME instead of `result'
|
|
||||||
--attr ATTR: select a specific attribution from the Nix expression
|
|
||||||
|
|
||||||
Any additional flags are passed to `nix-store'.
|
|
||||||
EOF
|
|
||||||
exit 0;
|
|
||||||
# '` hack
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($arg eq "--add-drv-link") {
|
|
||||||
$addDrvLink = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($arg eq "--no-out-link" or $arg eq "--no-link") {
|
|
||||||
$addOutLink = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($arg eq "--drv-link") {
|
|
||||||
$n++;
|
|
||||||
die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
|
|
||||||
$drvLink = $ARGV[$n];
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($arg eq "--out-link" or $arg eq "-o") {
|
|
||||||
$n++;
|
|
||||||
die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
|
|
||||||
$outLink = $ARGV[$n];
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($arg eq "--attr" or $arg eq "-A") {
|
|
||||||
$n++;
|
|
||||||
die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
|
|
||||||
push @instArgs, ("--attr", $ARGV[$n]);
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($arg eq "--arg" || $arg eq "--argstr") {
|
|
||||||
die "$0: `$arg' requires two arguments\n" unless $n + 2 < scalar @ARGV;
|
|
||||||
push @instArgs, ($arg, $ARGV[$n + 1], $ARGV[$n + 2]);
|
|
||||||
$n += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($arg eq "--log-type") {
|
|
||||||
$n++;
|
|
||||||
die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
|
|
||||||
push @instArgs, ($arg, $ARGV[$n]);
|
|
||||||
push @buildArgs, ($arg, $ARGV[$n]);
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($arg eq "--option") {
|
|
||||||
die "$0: `$arg' requires two arguments\n" unless $n + 2 < scalar @ARGV;
|
|
||||||
push @instArgs, ($arg, $ARGV[$n + 1], $ARGV[$n + 2]);
|
|
||||||
push @buildArgs, ($arg, $ARGV[$n + 1], $ARGV[$n + 2]);
|
|
||||||
$n += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($arg eq "--max-jobs" or $arg eq "-j" or $arg eq "--max-silent-time" or $arg eq "--log-type" or $arg eq "--cores") {
|
|
||||||
$n++;
|
|
||||||
die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
|
|
||||||
push @buildArgs, ($arg, $ARGV[$n]);
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($arg eq "--dry-run") {
|
|
||||||
push @buildArgs, "--dry-run";
|
|
||||||
$dryRun = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($arg eq "--show-trace") {
|
--add-drv-link)
|
||||||
push @instArgs, $arg;
|
addDrvLink=1
|
||||||
}
|
;;
|
||||||
|
|
||||||
elsif ($arg eq "--verbose" or substr($arg, 0, 2) eq "-v") {
|
--no-link)
|
||||||
push @buildArgs, $arg;
|
addOutLink=0
|
||||||
push @instArgs, $arg;
|
;;
|
||||||
$verbose = 1;
|
|
||||||
}
|
-*)
|
||||||
|
extraArgs="$extraArgs $i"
|
||||||
elsif ($arg eq "--quiet") {
|
;;
|
||||||
push @buildArgs, $arg;
|
|
||||||
push @instArgs, $arg;
|
*)
|
||||||
}
|
# Instantiate the Nix expression.
|
||||||
|
prefix=
|
||||||
elsif (substr($arg, 0, 1) eq "-") {
|
if test "$addDrvLink" = 0; then prefix=.nix-build-tmp-; fi
|
||||||
push @buildArgs, $arg;
|
storeExprs=$(@bindir@/nix-instantiate \
|
||||||
}
|
--add-root ./${prefix}derivation --indirect \
|
||||||
|
"$i")
|
||||||
|
|
||||||
|
for j in $storeExprs; do
|
||||||
|
echo "store expression is $(readlink "$j")" >&2
|
||||||
|
done
|
||||||
|
|
||||||
else {
|
# Build the resulting store derivation.
|
||||||
push @exprs, $arg;
|
prefix=
|
||||||
}
|
if test "$addOutLink" = 0; then prefix=.nix-build-tmp-; fi
|
||||||
}
|
outPaths=$(@bindir@/nix-store \
|
||||||
|
--add-root ./${prefix}result --indirect \
|
||||||
@exprs = ("./default.nix") if scalar @exprs == 0;
|
-rv $extraArgs $storeExprs)
|
||||||
|
|
||||||
|
for j in $outPaths; do
|
||||||
if (!defined $drvLink) {
|
echo "$(readlink "$j")"
|
||||||
$drvLink = "derivation";
|
done
|
||||||
$drvLink = ".nix-build-tmp-" . $drvLink if !$addDrvLink;
|
|
||||||
}
|
;;
|
||||||
|
esac
|
||||||
if (!defined $outLink) {
|
done
|
||||||
$outLink = "result";
|
|
||||||
$outLink = ".nix-build-tmp-" . $outLink if !$addOutLink;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
foreach my $expr (@exprs) {
|
|
||||||
|
|
||||||
# Instantiate.
|
|
||||||
my @drvPaths;
|
|
||||||
# !!! would prefer the perl 5.8.0 pipe open feature here.
|
|
||||||
my $pid = open(DRVPATHS, "-|") || exec "$binDir/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr;
|
|
||||||
while (<DRVPATHS>) {chomp; push @drvPaths, $_;}
|
|
||||||
if (!close DRVPATHS) {
|
|
||||||
die "nix-instantiate killed by signal " . ($? & 127) . "\n" if ($? & 127);
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $drvPath (@drvPaths) {
|
|
||||||
my $target = readlink $drvPath or die "cannot read symlink `$drvPath'";
|
|
||||||
print STDERR "derivation is $target\n" if $verbose;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Build.
|
|
||||||
my @outPaths;
|
|
||||||
$pid = open(OUTPATHS, "-|") || exec "$binDir/nix-store", "--add-root", $outLink, "--indirect", "-r",
|
|
||||||
@buildArgs, @drvPaths;
|
|
||||||
while (<OUTPATHS>) {chomp; push @outPaths, $_;}
|
|
||||||
if (!close OUTPATHS) {
|
|
||||||
die "nix-store killed by signal " . ($? & 127) . "\n" if ($? & 127);
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
next if $dryRun;
|
|
||||||
|
|
||||||
foreach my $outPath (@outPaths) {
|
|
||||||
my $target = readlink $outPath or die "cannot read symlink `$outPath'";
|
|
||||||
print "$target\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+29
-53
@@ -2,24 +2,13 @@
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
my $rootsDir = "@localstatedir@/nix/gcroots";
|
my $rootsDir = "@localstatedir@/nix/gcroots/channels";
|
||||||
|
|
||||||
my $stateDir = $ENV{"NIX_STATE_DIR"};
|
|
||||||
$stateDir = "@localstatedir@/nix" unless defined $stateDir;
|
|
||||||
|
|
||||||
|
|
||||||
# Turn on caching in nix-prefetch-url.
|
|
||||||
my $channelCache = "$stateDir/channel-cache";
|
|
||||||
mkdir $channelCache, 0755 unless -e $channelCache;
|
|
||||||
$ENV{'NIX_DOWNLOAD_CACHE'} = $channelCache if -W $channelCache;
|
|
||||||
|
|
||||||
|
|
||||||
# Figure out the name of the `.nix-channels' file to use.
|
# Figure out the name of the `.nix-channels' file to use.
|
||||||
my $home = $ENV{"HOME"};
|
my $home = $ENV{"HOME"};
|
||||||
die '$HOME not set' unless defined $home;
|
die '$HOME not set' unless defined $home;
|
||||||
my $channelsList = "$home/.nix-channels";
|
my $channelsList = "$home/.nix-channels";
|
||||||
|
|
||||||
my $nixDefExpr = "$home/.nix-defexpr";
|
|
||||||
|
|
||||||
|
|
||||||
my @channels;
|
my @channels;
|
||||||
@@ -31,7 +20,6 @@ sub readChannels {
|
|||||||
open CHANNELS, "<$channelsList" or die "cannot open `$channelsList': $!";
|
open CHANNELS, "<$channelsList" or die "cannot open `$channelsList': $!";
|
||||||
while (<CHANNELS>) {
|
while (<CHANNELS>) {
|
||||||
chomp;
|
chomp;
|
||||||
next if /^\s*\#/;
|
|
||||||
push @channels, $_;
|
push @channels, $_;
|
||||||
}
|
}
|
||||||
close CHANNELS;
|
close CHANNELS;
|
||||||
@@ -78,68 +66,56 @@ sub removeChannel {
|
|||||||
sub update {
|
sub update {
|
||||||
readChannels;
|
readChannels;
|
||||||
|
|
||||||
# Create the manifests directory if it doesn't exist.
|
# Get rid of all the old substitutes.
|
||||||
mkdir "$stateDir/manifests", 0755 unless -e "$stateDir/manifests";
|
system "@bindir@/nix-store --clear-substitutes";
|
||||||
|
die "cannot clear substitutes" if ($? != 0);
|
||||||
# Do we have write permission to the manifests directory? If not,
|
|
||||||
# then just skip pulling the manifest and just download the Nix
|
|
||||||
# expressions. If the user is a non-privileged user in a
|
|
||||||
# multi-user Nix installation, he at least gets installation from
|
|
||||||
# source.
|
|
||||||
if (-W "$stateDir/manifests") {
|
|
||||||
|
|
||||||
# Pull cache manifests.
|
|
||||||
foreach my $url (@channels) {
|
|
||||||
#print "pulling cache manifest from `$url'\n";
|
|
||||||
system("@bindir@/nix-pull", "--skip-wrong-store", "$url/MANIFEST") == 0
|
|
||||||
or die "cannot pull cache manifest from `$url'";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
# Pull cache manifests.
|
||||||
|
foreach my $url (@channels) {
|
||||||
|
print "pulling cache manifest from `$url'\n";
|
||||||
|
system "@bindir@/nix-pull '$url'/MANIFEST";
|
||||||
|
die "cannot pull cache manifest from `$url'" if ($? != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a Nix expression that fetches and unpacks the channel Nix
|
# Create a Nix expression that fetches and unpacks the channel Nix
|
||||||
# expressions.
|
# expressions.
|
||||||
|
|
||||||
my $inputs = "[";
|
my $nixExpr = "[";
|
||||||
foreach my $url (@channels) {
|
foreach my $url (@channels) {
|
||||||
$url =~ /\/([^\/]+)\/?$/;
|
|
||||||
my $channelName = $1;
|
|
||||||
$channelName = "unnamed" unless defined $channelName;
|
|
||||||
|
|
||||||
my $fullURL = "$url/nixexprs.tar.bz2";
|
my $fullURL = "$url/nixexprs.tar.bz2";
|
||||||
print "downloading Nix expressions from `$fullURL'...\n";
|
|
||||||
$ENV{"PRINT_PATH"} = 1;
|
$ENV{"PRINT_PATH"} = 1;
|
||||||
$ENV{"QUIET"} = 1;
|
my ($hash, $path) = `@bindir@/nix-prefetch-url '$fullURL' 2> /dev/null`;
|
||||||
my ($hash, $path) = `@bindir@/nix-prefetch-url '$fullURL'`;
|
|
||||||
die "cannot fetch `$fullURL'" if $? != 0;
|
die "cannot fetch `$fullURL'" if $? != 0;
|
||||||
chomp $path;
|
chomp $path;
|
||||||
$inputs .= '"' . $channelName . '"' . " " . $path . " ";
|
$nixExpr .= $path . " ";
|
||||||
}
|
}
|
||||||
$inputs .= "]";
|
$nixExpr .= "]";
|
||||||
|
|
||||||
|
$nixExpr =
|
||||||
|
"(import @datadir@/nix/corepkgs/channels/unpack.nix) " .
|
||||||
|
"{inputs = $nixExpr; system = \"@system@\";}";
|
||||||
|
|
||||||
# Figure out a name for the GC root.
|
# Figure out a name for the GC root.
|
||||||
my $userName = getpwuid($<);
|
my $userName = getpwuid($<);
|
||||||
die "who ARE you? go away" unless defined $userName;
|
die "who ARE you? go away" unless defined $userName;
|
||||||
|
|
||||||
my $rootFile = "$rootsDir/per-user/$userName/channels";
|
my $rootFile = "$rootsDir/$userName";
|
||||||
|
|
||||||
# Build the Nix expression.
|
# Instantiate the Nix expression.
|
||||||
print "unpacking channel Nix expressions...\n";
|
my $storeExpr = `echo '$nixExpr' | @bindir@/nix-instantiate --add-root '$rootFile'.tmp -`
|
||||||
my $outPath = `\\
|
or die "cannot instantiate Nix expression";
|
||||||
@bindir@/nix-build --out-link '$rootFile' --drv-link '$rootFile'.tmp \\
|
chomp $storeExpr;
|
||||||
@datadir@/nix/corepkgs/channels/unpack.nix \\
|
|
||||||
--argstr system @system@ --arg inputs '$inputs'`
|
# Build the resulting derivation.
|
||||||
or die "cannot unpack the channels";
|
my $outPath = `nix-store --add-root '$rootFile' -r '$storeExpr'`
|
||||||
|
or die "cannot realise store expression";
|
||||||
chomp $outPath;
|
chomp $outPath;
|
||||||
|
|
||||||
unlink "$rootFile.tmp";
|
unlink "$rootFile.tmp";
|
||||||
|
|
||||||
# Make the channels appear in nix-env.
|
# Make it the default Nix expression for `nix-env'.
|
||||||
unlink $nixDefExpr if -l $nixDefExpr; # old-skool ~/.nix-defexpr
|
system "@bindir@/nix-env --import '$outPath'";
|
||||||
mkdir $nixDefExpr or die "cannot create directory `$nixDefExpr'" if !-e $nixDefExpr;
|
die "cannot pull set default Nix expression to `$outPath'" if ($? != 0);
|
||||||
my $channelLink = "$nixDefExpr/channels";
|
|
||||||
unlink $channelLink; # !!! not atomic
|
|
||||||
symlink($outPath, $channelLink) or die "cannot symlink `$channelLink' to `$outPath'";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,53 +1,2 @@
|
|||||||
#! @perl@ -w
|
#! @shell@ -e
|
||||||
|
exec @bindir@/nix-store --gc "$@"
|
||||||
use strict;
|
|
||||||
|
|
||||||
my $profilesDir = "@localstatedir@/nix/profiles";
|
|
||||||
|
|
||||||
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
|
||||||
|
|
||||||
|
|
||||||
# Process the command line arguments.
|
|
||||||
my @args = ();
|
|
||||||
my $removeOld = 0;
|
|
||||||
|
|
||||||
for my $arg (@ARGV) {
|
|
||||||
if ($arg eq "--delete-old" || $arg eq "-d") {
|
|
||||||
$removeOld = 1;
|
|
||||||
} else {
|
|
||||||
push @args, $arg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# If `-d' was specified, remove all old generations of all profiles.
|
|
||||||
# Of course, this makes rollbacks to before this point in time
|
|
||||||
# impossible.
|
|
||||||
|
|
||||||
sub removeOldGenerations;
|
|
||||||
sub removeOldGenerations {
|
|
||||||
my $dir = shift;
|
|
||||||
|
|
||||||
my $dh;
|
|
||||||
opendir $dh, $dir or die;
|
|
||||||
|
|
||||||
foreach my $name (sort (readdir $dh)) {
|
|
||||||
next if $name eq "." || $name eq "..";
|
|
||||||
$name = $dir . "/" . $name;
|
|
||||||
if (-l $name && (readlink($name) =~ /link/)) {
|
|
||||||
print STDERR "removing old generations of profile $name\n";
|
|
||||||
system("$binDir/nix-env", "-p", $name, "--delete-generations", "old");
|
|
||||||
}
|
|
||||||
elsif (! -l $name && -d $name) {
|
|
||||||
removeOldGenerations $name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir $dh or die;
|
|
||||||
}
|
|
||||||
|
|
||||||
removeOldGenerations $profilesDir if $removeOld;
|
|
||||||
|
|
||||||
|
|
||||||
# Run the actual garbage collector.
|
|
||||||
exec "$binDir/nix-store", "--gc", @args;
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
#! @perl@ -w -I@libexecdir@/nix
|
|
||||||
|
|
||||||
use SSH;
|
|
||||||
|
|
||||||
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
|
||||||
|
|
||||||
|
|
||||||
if (scalar @ARGV < 1) {
|
|
||||||
print STDERR <<EOF
|
|
||||||
Usage: nix-copy-closure [--from | --to] HOSTNAME [--sign] [--gzip] PATHS...
|
|
||||||
EOF
|
|
||||||
;
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Get the target host.
|
|
||||||
my $sshHost;
|
|
||||||
|
|
||||||
my $sign = 0;
|
|
||||||
|
|
||||||
my $compressor = "";
|
|
||||||
my $decompressor = "";
|
|
||||||
|
|
||||||
my $toMode = 1;
|
|
||||||
|
|
||||||
|
|
||||||
# !!! Copied from nix-pack-closure, should put this in a module.
|
|
||||||
my @storePaths = ();
|
|
||||||
|
|
||||||
while (@ARGV) {
|
|
||||||
my $arg = shift @ARGV;
|
|
||||||
|
|
||||||
if ($arg eq "--sign") {
|
|
||||||
$sign = 1;
|
|
||||||
}
|
|
||||||
elsif ($arg eq "--gzip") {
|
|
||||||
$compressor = "| gzip";
|
|
||||||
$decompressor = "gunzip |";
|
|
||||||
}
|
|
||||||
elsif ($arg eq "--from") {
|
|
||||||
$toMode = 0;
|
|
||||||
}
|
|
||||||
elsif ($arg eq "--to") {
|
|
||||||
$toMode = 1;
|
|
||||||
}
|
|
||||||
elsif (!defined $sshHost) {
|
|
||||||
$sshHost = $arg;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
push @storePaths, $arg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
openSSHConnection $sshHost or die "$0: unable to start SSH\n";
|
|
||||||
|
|
||||||
|
|
||||||
if ($toMode) { # Copy TO the remote machine.
|
|
||||||
|
|
||||||
my @allStorePaths;
|
|
||||||
|
|
||||||
# Get the closure of this path.
|
|
||||||
my $pid = open(READ, "set -f; $binDir/nix-store --query --requisites @storePaths|") or die;
|
|
||||||
|
|
||||||
while (<READ>) {
|
|
||||||
chomp;
|
|
||||||
die "bad: $_" unless /^\//;
|
|
||||||
push @allStorePaths, $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
close READ or die "nix-store failed: $?";
|
|
||||||
|
|
||||||
|
|
||||||
# Ask the remote host which paths are invalid.
|
|
||||||
open(READ, "set -f; ssh $sshHost @sshOpts nix-store --check-validity --print-invalid @allStorePaths|");
|
|
||||||
my @missing = ();
|
|
||||||
while (<READ>) {
|
|
||||||
chomp;
|
|
||||||
push @missing, $_;
|
|
||||||
}
|
|
||||||
close READ or die;
|
|
||||||
|
|
||||||
|
|
||||||
# Export the store paths and import them on the remote machine.
|
|
||||||
if (scalar @missing > 0) {
|
|
||||||
print STDERR "copying these missing paths:\n";
|
|
||||||
print STDERR " $_\n" foreach @missing;
|
|
||||||
my $extraOpts = "";
|
|
||||||
$extraOpts .= "--sign" if $sign == 1;
|
|
||||||
system("set -f; nix-store --export $extraOpts @missing $compressor | ssh $sshHost @sshOpts '$decompressor nix-store --import'") == 0
|
|
||||||
or die "copying store paths to remote machine `$sshHost' failed: $?";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
else { # Copy FROM the remote machine.
|
|
||||||
|
|
||||||
# Query the closure of the given store paths on the remote
|
|
||||||
# machine. Paths are assumed to be store paths; there is no
|
|
||||||
# resolution (following of symlinks).
|
|
||||||
my $pid = open(READ,
|
|
||||||
"set -f; ssh @sshOpts $sshHost nix-store --query --requisites @storePaths|") or die;
|
|
||||||
|
|
||||||
my @allStorePaths;
|
|
||||||
|
|
||||||
while (<READ>) {
|
|
||||||
chomp;
|
|
||||||
die "bad: $_" unless /^\//;
|
|
||||||
push @allStorePaths, $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
close READ or die "nix-store on remote machine `$sshHost' failed: $?";
|
|
||||||
|
|
||||||
|
|
||||||
# What paths are already valid locally?
|
|
||||||
open(READ, "set -f; @bindir@/nix-store --check-validity --print-invalid @allStorePaths|");
|
|
||||||
my @missing = ();
|
|
||||||
while (<READ>) {
|
|
||||||
chomp;
|
|
||||||
push @missing, $_;
|
|
||||||
}
|
|
||||||
close READ or die;
|
|
||||||
|
|
||||||
|
|
||||||
# Export the store paths on the remote machine and import them on locally.
|
|
||||||
if (scalar @missing > 0) {
|
|
||||||
print STDERR "copying these missing paths:\n";
|
|
||||||
print STDERR " $_\n" foreach @missing;
|
|
||||||
my $extraOpts = "";
|
|
||||||
$extraOpts .= "--sign" if $sign == 1;
|
|
||||||
system("set -f; ssh $sshHost @sshOpts 'nix-store --export $extraOpts @missing $compressor' | $decompressor @bindir@/nix-store --import") == 0
|
|
||||||
or die "copying store paths from remote machine `$sshHost' failed: $?";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#! @perl@ -w -I@libexecdir@/nix
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use File::Temp qw(tempdir);
|
|
||||||
use NixManifest;
|
|
||||||
use GeneratePatches;
|
|
||||||
|
|
||||||
if (scalar @ARGV != 5) {
|
|
||||||
print STDERR <<EOF;
|
|
||||||
Usage: nix-generate-patches NAR-DIR PATCH-DIR PATCH-URI OLD-MANIFEST NEW-MANIFEST
|
|
||||||
|
|
||||||
This command generates binary patches between NAR files listed in
|
|
||||||
OLD-MANIFEST and NEW-MANIFEST. The patches are written to the
|
|
||||||
directory PATCH-DIR, and the prefix PATCH-URI is used to generate URIs
|
|
||||||
for the patches. The patches are added to NEW-MANIFEST. All NARs are
|
|
||||||
required to exist in NAR-DIR. Patches are generated between
|
|
||||||
succeeding versions of packages with the same name.
|
|
||||||
EOF
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $narPath = $ARGV[0];
|
|
||||||
my $patchesPath = $ARGV[1];
|
|
||||||
my $patchesURL = $ARGV[2];
|
|
||||||
my $srcManifest = $ARGV[3];
|
|
||||||
my $dstManifest = $ARGV[4];
|
|
||||||
|
|
||||||
my (%srcNarFiles, %srcLocalPaths, %srcPatches);
|
|
||||||
readManifest $srcManifest, \%srcNarFiles, \%srcLocalPaths, \%srcPatches;
|
|
||||||
|
|
||||||
my (%dstNarFiles, %dstLocalPaths, %dstPatches);
|
|
||||||
readManifest $dstManifest, \%dstNarFiles, \%dstLocalPaths, \%dstPatches;
|
|
||||||
|
|
||||||
my $tmpDir = tempdir("nix-generate-patches.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
|
||||||
or die "cannot create a temporary directory";
|
|
||||||
|
|
||||||
generatePatches \%srcNarFiles, \%dstNarFiles, \%srcPatches, \%dstPatches,
|
|
||||||
$narPath, $patchesPath, $patchesURL, $tmpDir;
|
|
||||||
|
|
||||||
propagatePatches \%srcPatches, \%dstNarFiles, \%dstPatches;
|
|
||||||
|
|
||||||
writeManifest $dstManifest, \%dstNarFiles, \%dstPatches;
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
export HOME=/tmp
|
|
||||||
export NIX_REMOTE=daemon
|
|
||||||
|
|
||||||
TMP_DIR="${TMP_DIR:-/tmp/nix-export}"
|
|
||||||
|
|
||||||
@coreutils@/mkdir -p "$TMP_DIR" || true
|
|
||||||
@coreutils@/chmod a+r "$TMP_DIR"
|
|
||||||
|
|
||||||
needed_path="?$QUERY_STRING"
|
|
||||||
needed_path="${needed_path#*[?&]needed_path=}"
|
|
||||||
needed_path="${needed_path%%&*}"
|
|
||||||
#needed_path="$(echo $needed_path | ./unhttp)"
|
|
||||||
needed_path="${needed_path//%2B/+}"
|
|
||||||
needed_path="${needed_path//%3D/=}"
|
|
||||||
|
|
||||||
echo needed_path: "$needed_path" >&2
|
|
||||||
|
|
||||||
NIX_STORE="${NIX_STORE_DIR:-/nix/store}"
|
|
||||||
|
|
||||||
echo NIX_STORE: "${NIX_STORE}" >&2
|
|
||||||
|
|
||||||
full_path="${NIX_STORE}"/"$needed_path"
|
|
||||||
|
|
||||||
if [ "$needed_path" != "${needed_path%.drv}" ]; then
|
|
||||||
echo "Status: 403 You should create the derivation file yourself"
|
|
||||||
echo "Content-Type: text/plain"
|
|
||||||
echo
|
|
||||||
echo "Refusing to disclose derivation contents"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if @bindir@/nix-store --check-validity "$full_path"; then
|
|
||||||
if ! [ -e nix-export/"$needed_path".nar.gz ]; then
|
|
||||||
@bindir@/nix-store --export "$full_path" | @gzip@ > "$TMP_DIR"/"$needed_path".nar.gz
|
|
||||||
@coreutils@/ln -fs "$TMP_DIR"/"$needed_path".nar.gz nix-export/"$needed_path".nar.gz
|
|
||||||
fi;
|
|
||||||
echo "Status: 301 Moved"
|
|
||||||
echo "Location: nix-export/"$needed_path".nar.gz"
|
|
||||||
echo
|
|
||||||
else
|
|
||||||
echo "Status: 404 No such path found"
|
|
||||||
echo "Content-Type: text/plain"
|
|
||||||
echo
|
|
||||||
echo "Path not found:"
|
|
||||||
echo "$needed_path"
|
|
||||||
echo "checked:"
|
|
||||||
echo "$full_path"
|
|
||||||
fi
|
|
||||||
|
|
||||||
Loaded 100 of 420 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user