1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00
Commit graph

496 commits

Author SHA1 Message Date
Eelco Dolstra 1bc6afefac * Cleanup. 2004-06-08 13:21:03 +00:00
Eelco Dolstra 5e4a2272bf * Drain the output of the build hook to show error messages. Ugly
hack.
2004-05-18 14:52:35 +00:00
Eelco Dolstra 8e9fd57ef9 * setpgrp() is not POSIX (and on Mac OS X it's different than on
Linux), so use setpgid().
2004-05-18 09:45:18 +00:00
Eelco Dolstra ace8872706 * execl() requires a terminating 0.
* When a fast build wakes up a goal, try to start that goal in the
  same iteration of the startBuild() loop of run().  Otherwise no job
  might be started until the next job terminates.
2004-05-14 12:24:29 +00:00
Eelco Dolstra 4fc00cbec1 * Distributed builds and load balancing now seem to work pretty well.
(Though the `build-remote.pl' script has a gigantic race condition).
2004-05-13 22:52:37 +00:00
Eelco Dolstra 25db622454 * Load balancing. `build-remote.pl' will only execute up to a
per-machine maximum number of parallel jobs on a remote machine.
2004-05-13 19:35:46 +00:00
Eelco Dolstra a8306cb98f * The build hooks used to implement distributed builds can now be run
in parallel.  Hooks are more efficient: locks on output paths are
  only acquired when the hook says that it is willing to accept a
  build job.  Hooks now work in two phases.  First, they should first
  tell Nix whether they are willing to accept a job.  Nix guarantuees
  that no two hooks will ever be in the first phase at the same time
  (this simplifies the implementation of hooks, since they don't have
  to perform locking (?)).  Second, if they accept a job, they are
  then responsible for building it (on the remote system), and copying
  the result back.  These can be run in parallel with other hooks and
  locally executed jobs.

  The implementation is a bit messy right now, though.  

* The directory `distributed' shows a (hacky) example of a hook that
  distributes build jobs over a set of machines listed in a
  configuration file.
2004-05-13 19:14:49 +00:00
Eelco Dolstra efa5fa1a91 * A switch `-j NUMBER' to set the maximum number of parallel jobs (0 =
no limit).
* Add missing file to distribution.
2004-05-12 14:20:32 +00:00
Eelco Dolstra aa5a5084e4 * Pass to the build hook all sorts of information useful for
distributing a build action to another machine.  In particular, the
  paths in the input closures, the output paths, and successor mapping
  for sub-derivations.
2004-05-12 13:32:26 +00:00
Eelco Dolstra 8c0b42f857 * An quick and dirty hack to support distributed builds. 2004-05-12 09:35:51 +00:00
Eelco Dolstra c8d3882cdc * True parallel builds. Nix can now run as many build jobs in
parallel as possible (similar to GNU Make's `-j' switch).  This is
  useful on SMP systems, but it is especially useful for doing builds
  on multiple machines.  The idea is that a large derivation is
  initiated on one master machine, which then distributes
  sub-derivations to any number of slave machines.  This should not
  happen synchronously or in lock-step, so the master must be capable
  of dealing with multiple parallel build jobs.  We now have the
  infrastructure to support this.

  TODO: substitutes are currently broken.
2004-05-11 18:05:44 +00:00
Eelco Dolstra aea436503e * Ignore interrupt signals while handling an exception.
* Ignore EINTR in reads and writes.
2004-05-11 13:48:25 +00:00
Eelco Dolstra 256eeab711 * Allow the location of the store etc. to be specified using
environment variables.
* Started adding some automatic tests.
* Do a `make check' when building RPMs.
2004-05-04 12:15:30 +00:00
Eelco Dolstra d4779abc04 * Pass SYSTEM through config.h, and allow spaces. 2004-04-23 15:16:08 +00:00
Eelco Dolstra d7238bc84e * Don't create $(localstatedir)/nix/profiles if --disable-init-state
is specified.
2004-04-22 07:47:41 +00:00
Eelco Dolstra f79e9c2d22 * Do initialise state (the DB etc.) when doing a `make install',
unless `--disable-init-state' is passed to configure.
2004-04-21 10:54:46 +00:00
Eelco Dolstra 8e459d919d * Recurse into attribute sets and lists when getting derivations from
an expression.
2004-04-21 09:37:37 +00:00
Eelco Dolstra a4d2b22c8c * Be stricter in verifying store paths. 2004-04-14 08:08:55 +00:00
Eelco Dolstra 59b94ee18a * When something goes wrong in the evaluation of a Nix expression,
print a nice backtrace of the stack, rather than vomiting a gigantic
  (and useless) aterm on the screen.  Example:

    error: while evaluating file `.../pkgs/system/test.nix':
    while evaluating attribute `subversion' at `.../pkgs/system/all-packages-generic.nix', line 533:
    while evaluating function at `.../pkgs/applications/version-management/subversion/default.nix', line 1:
    assertion failed at `.../pkgs/applications/version-management/subversion/default.nix', line 13

  Since the Nix expression language is lazy, the trace may be
  misleading.  The purpose is to provide a hint as to the location of
  the problem.
2004-04-05 22:27:41 +00:00
Eelco Dolstra a520b1cbc3 * Print a more useful error message in case of an invalid derivation
binding.
2004-04-02 10:49:37 +00:00
Eelco Dolstra c4ac2a164a * The recent change in nixpkgs of calling `stdenv.mkDerivation'
instead of `derivation' triggered a huge slowdown in the Nix
  expression evaluator.  Total execution time of `nix-env -qa' went up
  by a factor of 60 or so.

  This scalability problem was caused by expressions such as

    (x: y: ... x ...) a b

  where `a' is a large term (say, the one in
  `all-packages-generic.nix').  Then the first beta-reduction would
  produce

    (y: ... a ...) b

  by substituting `a' for `x'.  The second beta-reduction would then
  substitute `b' for `y' into the body `... a ...', which is a large
  term due to `a', and thus causes a large traversal to be performed
  by substitute() in the second reduction.  This is however entirely
  redundant, since `a' cannot contain free variables (since we never
  substitute below a weak head normal form).

  The solution is to wrap substituted terms into a `Closed'
  constructor, i.e.,

    subst(subs, Var(x)) = Closed(e) iff subs[x] = e

  have substitution not descent into closed terms,

    subst(subs, Closed(x)) = Closed(x)

  and otherwise ignore them for evaluation,

    eval(Closed(x)) = eval(x).

* Fix a typo that caused incorrect substitutions to be performed in
  simple lambdas, e.g., `(x: x: x) a' would reduce to `(x: a)'.
2004-03-30 15:05:35 +00:00
Eelco Dolstra ac4d39f9db * Added an operator `?' to test for attribute existence, e.g.,
`attrs ? x' yields true iff `attrs' has an attribute named `x'.
2004-03-28 21:15:01 +00:00
Eelco Dolstra f958bcdf1f * Added an operator `~' to select paths within a derivation. E.g.,
{stdenv, bash}: derivation {
      builder = bash ~ /bin/sh;
      args = ["-e" "-x" ./builder.sh];
      ...
    }

  Here the attribute `builder' will evaluate to, e.g.,
  `/nix/store/1234abcd...-bash-2.0.1/bin/sh'.
2004-03-28 20:58:28 +00:00
Eelco Dolstra db3e644c1c * Added plain lambdas, e.g., `let { id = x: x; const = x: y: x; }'.
`bla:' is now no longer parsed as a URL.

* Re-enabled support for the `args' attribute in derivations to
  specify command line arguments to the builder, e.g.,

    ...
    builder = /usr/bin/python;
    args = ["-c" ./builder.py];
    ...
2004-03-28 20:34:22 +00:00
Eelco Dolstra f8cd904e05 * Disallow the Nix store or any of its parents from being symlinks.
This is because the contents of these symlinks are not incorporated
  into the hashes of derivations, and could therefore cause a mismatch
  between the build system and the target system.  E.g., if
  `/nix/store' is a symlink to `/data/nix/store', then a builder could
  expand this path and store the result.  If on the target system
  `/nix/store' is not a symlink, or is a symlink that points somewhere
  else, we have a dangling pointer.

  The trigger for this change is that gcc 3.3.3 does exactly that (it
  applies realpath() to some files, such as libraries, which causes
  our impurity checker to bail out.)

  An annoying side-effect of this change is that it makes it harder to
  move the Nix store to a different file system.  On Linux, bind
  mounts can be used instead of symlink for this purpose (e.g., `mount
  -o bind /data/nix/store /nix/store').
2004-03-27 17:58:04 +00:00
Eelco Dolstra f0f7a9f299 * Do not close a nesting level twice after close() has been
called explicitly on a Nest object.
2004-03-27 15:33:19 +00:00
Eelco Dolstra 7823db2137 * Some more nesting. 2004-03-22 21:42:28 +00:00
Eelco Dolstra 777e13b94b * Nix now has three different formats for the log information it
writes to stderr:
  
  - `pretty': the old nested style (default)
  - `escapes': uses escape codes to indicate nesting and message
    level; can be processed using `log2xml'
  - `flat': just plain text, no nesting

  These can be set using `--log-type TYPE' or the NIX_LOG_TYPE
  environment variable.
2004-03-22 20:53:49 +00:00
Eelco Dolstra 79bb0008ec * `null' is a normal form. 2004-03-19 14:45:45 +00:00
Eelco Dolstra e6253b58cd * Escape codes to force line breaks to be ignored. 2004-03-18 21:32:15 +00:00
Eelco Dolstra 3f3c4cce5a * Added an extra escape code to signal "unimportant" messages. If a tree only has
unimportant messages, it is collapsed by the default.
* Also added an optional integer argument to the escape code for opening a nesting 
  level to indicate lack of importance.  If set, the tree is collapsed by default.
2004-03-18 21:04:14 +00:00
Eelco Dolstra 84c617966b * Collapsable trees. 2004-03-18 18:26:22 +00:00
Eelco Dolstra c2fc2c13c9 * Use unordered lists, which is more sensible semantically for
representing tree structures.
2004-03-18 14:58:16 +00:00
Eelco Dolstra a784fd5792 * Don't use tables. Konqueror likes this much better. 2004-03-18 13:04:05 +00:00
Eelco Dolstra 8ce3dd4887 * Display the popup directly over the abbreviation. 2004-03-17 16:55:53 +00:00
Eelco Dolstra 8330c8202a * A simpler way of implementing the store reference popups, thanks to
Martin and CSS guru Martijn Vermaat.
2004-03-17 16:52:48 +00:00
Eelco Dolstra b5539e7a30 * Store paths are now abbreviated in the generated HTML file.
Hovering over the abbreviated path will reveal the full path.  This
  probably only works in Mozilla.
2004-03-16 12:47:09 +00:00
Eelco Dolstra 9d2669d218 * Added a utility that can be used to produce nice HTML pages from Nix
build logs.  The program `log2xml' converts a Nix build log (read
  from standard input) into XML file that can then be converted to
  XHTML by the `log2html.xsl' stylesheet.  The CSS stylesheet
  `logfile.css' is necessary to make it look good.

  This is primarily useful if the log file has a *tree structure*,
  i.e., that sub-tasks such as the various phases of a build (unpack,
  configure, make, etc.) or recursive invocations of Make are
  represented as such.  While a log file is in principle an
  unstructured plain text file, builders can communicate this tree
  structure to `log2xml' by using escape sequences:

  - "\e[p" starts a new nesting level; the first line following the
    escape code is the header;

  - "\e[q" ends the current nesting level.

  The generic builder in nixpkgs (not yet committed) uses this.  It
  shouldn't be to hard to patch GNU Make to speak this protocol.

  Further improvements to the generated HTML pages are to allow
  collapsing/expanding of subtrees, and to abbreviate store paths (but
  to show the full path by hovering the mouse over it).
2004-03-15 21:51:14 +00:00
Eelco Dolstra a5619f1dff * Set the NIX_STORE and NIX_BUILD_TOP environment variables in
builders to point to the store and the temporary build directory,
  respectively.  Useful for purity checking.
* Also set TEMPDIR, TMPDIR, TEMP, and TEMP to NIX_BUILD_TOP to make
  sure that tools in the builder store temporary files in the right
  location.
2004-03-12 10:45:08 +00:00
Eelco Dolstra dbf547645d * Resolve an ambiguity between ifs and attribute selection, e.g., `if
b then x else y.z'.
2004-02-19 13:11:12 +00:00
Eelco Dolstra 0dfdafdf6d * Allow linking against an external Berkeley DB / ATerm library. 2004-02-16 16:37:16 +00:00
Eelco Dolstra f34de12140 * Allow the location of the store to be specified (--with-store-dir).
* Do not create stuff in localstatedir when doing `make install'
  (since we may not have write access).  In general, installation of
  constant code/data should be separate from the initialisation of
  mutable state.
2004-02-16 15:23:19 +00:00
Eelco Dolstra fbc48a469c * Inherited attributes in recursive attribute sets are in scope of the
non-inherited attributes.
2004-02-16 09:18:35 +00:00
Eelco Dolstra 76c0e85929 * The environment variable NIX_ROOT can now be set to execute Nix in a
chroot() environment.
* A operation `--validpath' to register path validity.  Useful for
  bootstrapping in a pure Nix environment.
* Safety checks: ensure that files involved in store operations are in
  the store.
2004-02-14 21:44:18 +00:00
Eelco Dolstra 6f5a5ea5ea * Regression fix: realise substitutes and detect cycles. 2004-02-13 10:45:09 +00:00
Eelco Dolstra 00fe1a506f * When creating a new generation, also make the normal form of the
derivation (i.e., the closure store expression) a root of the
  garbage collector.  This ensures that running `nix-collect-garbage
  --no-successors' is safe.
2004-02-11 10:25:31 +00:00
Eelco Dolstra 92e832348d * Lots of manual stuff. Reference pages for most Nix commands.
* nix-pull now requires the full url to the manifest, i.e.,
  `/MANIFEST/' is no longer automatically appended.
* nix-prefetch-url works again.
2004-02-10 16:14:47 +00:00
Eelco Dolstra 6551b36790 * Print what generation we are switching to; honour --dry-run flag. 2004-02-10 13:42:58 +00:00
Eelco Dolstra 618aa69b01 * In --upgrade': added flags --lt', --leq', --always' to specify
whether we want to upgrade if the current version is less than the
  available version (default), when it is less or equal, or always.
  
* Added a flag `--dry-run' to show what would happen in `--install',
  `--uninstall', and `--upgrade', without actually performing the
  operation.
2004-02-09 11:59:39 +00:00
Eelco Dolstra 06a75a7e0c * A command `--switch-generation' to switch to a specific generation
of the current profile, e.g.,

    $ nix-env --list-generations
    ...
    39   2004-02-02 17:53:53
    40   2004-02-02 17:55:18
    41   2004-02-02 17:55:41
    42   2004-02-02 17:55:50   (current)

    $ nix-env --switch-generation 39

    $ ls -l /nix/var/nix/profiles/default
    ... default -> default-39-link

* Also a command `--rollback' which is just a convenience operation to
  rollback to the oldest generation younger than the current one.

  Note that generations properly form a tree.  E.g., if after
  switching to generation 39, we perform an installation action,
  a 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
  implemented; generations form a linear sequence.
2004-02-08 14:07:43 +00:00
Eelco Dolstra b8675aee54 * In `--list-generations', show what the current generation is. 2004-02-06 16:16:55 +00:00
Eelco Dolstra 73ab2ed4fd * A command `--list-generations' to show all generations for a
profile.
2004-02-06 16:03:27 +00:00
Eelco Dolstra 7c0fa4474f * More refactoring. 2004-02-06 14:57:10 +00:00
Eelco Dolstra 7abf9911d9 * Refactoring. 2004-02-06 14:49:41 +00:00
Eelco Dolstra 49bafe1faf * Use the profile pointed to by ~/.nix-profile if no --profile
argument is specified.
2004-02-06 10:59:06 +00:00
Eelco Dolstra 66e94d3275 * Improvements to profiles. Generations are now per-profile, e.g.,
default -> default-94-link
  default-82-link -> /nix/store/cc4480...
  default-83-link -> /nix/store/caeec8...
  ...
  default-94-link -> /nix/store/2896ca...
  experimental -> experimental-2-link
  experimental-1-link -> /nix/store/cc4480...
  experimental-2-link -> /nix/store/a3148f...

* `--profile' / `-p' -> `--switch-profile' / `-S'
* `--link' / `-l' -> `--profile' / `-p'
* The default profile is stored in $prefix/var/nix/profiles.
  $prefix/var/nix/links is gone.  Profiles can be stored anywhere.
* The current profile is now referenced from ~/.nix-profile, not
  ~/.nix-userenv.
* The roots to the garbage collector now have extension `.gcroot', not
  `.id'.
2004-02-06 10:30:20 +00:00
Eelco Dolstra d445da7a7b * Extended the `inherit' syntax to optionally select attributes from
other attribute sets, rather than the current scope.  E.g.,
  
    {inherit (pkgs) gcc binutils;}

  is equivalent to

    {gcc = pkgs.gcc; binutils = pkgs.binutils;}

  I am not so happy about the syntax.
2004-02-04 17:23:26 +00:00
Eelco Dolstra 9d25466b34 * An attribute set update operator (//). E.g.,
{x=1; y=2; z=3;} // {y=4;}  =>  {x=1; y=4; z=3;}
2004-02-04 16:49:51 +00:00
Eelco Dolstra 9b44480612 * Use a map to lookup primops.
* Various performance improvements in the evaluator.
* Do not link against unused (and missing!) libraries (-lsglr, etc.).
2004-02-04 16:03:29 +00:00
Eelco Dolstra c4f7ae4aa5 * Verify that all variables in a Nix expression are defined. 2004-02-03 14:45:34 +00:00
Eelco Dolstra 1c9c0a5a46 * Added syntactic sugar to the construction of attribute sets to
`inherit' variables from the surrounding lexical scope.

  E.g.,

    {stdenv, libfoo}: derivation {
      builder = ./bla;
      inherit stdenv libfoo;
      xyzzy = 1;
    }

  is equivalent to

    {stdenv, libfoo}: derivation {
      builder = ./bla;
      stdenv = stdenv;
      libfoo = libfoo;
      xyzzy = 1;
    }

  Note that for mutually recursive attribute set definitions (`rec
  {...}'), this also works, that is, `rec {inherit x;}' is equivalent
  to `let {fresh = x; body = rec {x = fresh;};}', *not*
  `rec {x = x}'.
2004-02-02 21:39:33 +00:00
Eelco Dolstra d9f30fe7c7 * Sort `nix-env -q' output by derivation name.
* `--version' flag for all commands.
* Manual updates.
2004-02-02 10:51:54 +00:00
Eelco Dolstra 47c003cb59 * Doh! 2004-01-30 17:14:08 +00:00
Eelco Dolstra 619f20775d * Parser numbers again.
* Include missing files in distributions.
2004-01-30 17:06:03 +00:00
Eelco Dolstra c625718513 * Detect flex and bison; updated the manual. 2004-01-30 16:32:14 +00:00
Eelco Dolstra c5baaafae6 * Replaced the SDF parser by a substantially faster Bison/Flex
parser (roughly 80x faster).

  The absolutely latest version of Bison (1.875c) is required for
  reentrant GLR support, as well as a recent version of Flex (say,
  2.5.31).  Note that most Unix distributions ship with the
  prehistoric Flex 2.5.4, which doesn't support reentrancy.
2004-01-30 15:21:42 +00:00
Eelco Dolstra abd1878b26 * Optimised the SDF grammar. 2004-01-29 14:24:53 +00:00
Eelco Dolstra 840551ebdb * Extra bit S' in --query --status' output: show whether there are
any substitutes for the derivation.
2004-01-21 16:41:17 +00:00
Eelco Dolstra 1109ea0680 * Fixed a subtle uninitialised variable bug in ATermMaps copied from
ATermMaps.  Found thanks to Valgrind!
2004-01-21 14:49:32 +00:00
Eelco Dolstra 47f19b6293 * Absolutise the specified path in --import' and --profile'. 2004-01-20 20:36:58 +00:00
Eelco Dolstra 291030b900 * Remove debug message. 2004-01-15 20:58:44 +00:00
Eelco Dolstra 447089a5f6 * Catch SIGINT to terminate cleanly when the user tries to interrupt
Nix.  This is to prevent Berkeley DB from becoming wedged.

  Unfortunately it is not possible to throw C++ exceptions from a
  signal handler.  In fact, you can't do much of anything except
  change variables of type `volatile sig_atomic_t'.  So we set an
  interrupt flag in the signal handler and check it at various
  strategic locations in the code (by calling checkInterrupt()).
  Since this is unlikely to cover all cases (e.g., (semi-)infinite
  loops), sometimes SIGTERM may now be required to kill Nix.
2004-01-15 20:23:55 +00:00
Eelco Dolstra 08719c6c97 * Obsolete. 2004-01-15 20:13:54 +00:00
Eelco Dolstra 55e11bc0d3 * In nix-env --query --status', determine the I' bit by looking at
the output path of a derivation, not the path of its store
  expression.  This ensures that changes that affect the path of the
  store expression but not the output path, do not affect the
  `installed' state of a derivation.
2004-01-15 14:43:00 +00:00
Eelco Dolstra ff9af107d3 * Option `-B' to always show the output of builders, regardless of
verbosity level.
2004-01-13 16:35:43 +00:00
Eelco Dolstra 3495d153b3 * Periodically checkpoint the log. 2004-01-13 13:37:25 +00:00
Eelco Dolstra 698e880c9f * Tricky: make sure that the accessor count is not reset to 0 if
recovery fails.
2004-01-13 12:36:43 +00:00
Eelco Dolstra 23fbc72f5d * Print error messages, not debug messages. 2004-01-13 11:53:12 +00:00
Eelco Dolstra 4c4fe7a114 * Changed the extension for store expressions from ".nix" to ".store"
(following the Usenix paper).
2004-01-12 10:44:48 +00:00
Eelco Dolstra 46a71c857c * Option --force-realise' in nix-store --query'. 2004-01-09 14:18:28 +00:00
Eelco Dolstra 7959354379 * Upgraded to Berkeley DB 4.2.52. The main advantage of 4.2 is that
it automatically removes log files when they are no longer needed.

  *** IMPORTANT ***

  If you have an existing Nix installation, you must checkpoint the
  Nix database to prevent recent transactions from being undone.  Do
  the following:

  - optional: make a backup of $prefix/var/nix/db.

  - run `db_checkpoint' from Berkeley DB 4.1:
  
    $ db_checkpoint -h $prefix/var/nix/db -1

  - optional (?): run `db_recover' from Berkeley DB 4.1:

    $ db_recover -h $prefix/var/nix/db

  - remove $prefix/var/nix/db/log* and $prefix/var/nix/db/__db*
2004-01-07 15:53:14 +00:00
Eelco Dolstra 4a373a3e9a * Implemented Eelco V.'s `nix-env -I' command to specify the default
path of the Nix expression to be used with the import, upgrade, and
  query commands.  For instance,

  $ nix-env -I ~/nixpkgs/pkgs/system/i686-linux.nix

  $ nix-env --query --available   [aka -qa]
  sylpheed-0.9.7
  bison-1.875
  pango-1.2.5
  subversion-0.35.1
  ...

  $ nix-env -i sylpheed

  $ nix-env -u subversion

  There can be only one default at a time.

* If the path to a Nix expression is a symlink, follow the symlink
  prior to resolving relative path references in the expression.
2004-01-05 16:26:43 +00:00
Eelco Dolstra f83c5e3e5f * Implemented Eelco V.'s `-p' command to switch profiles. It switches
the symlink ~/.nix-userenv to the given argument (which defaults to
  .../links/current).  /etc/profile.d/nix-profile creates this symlink
  if it doesn't exist yet.  Example use:

  $ nix-env -l my_profile -i foo.nix subversion quake
  $ nix-env -p my_profile

  I don't like the term "profile".  Let's deprecate it :-)
2004-01-05 11:18:59 +00:00
Eelco Dolstra 94175e978a * RPM spec file.
* Respect DESTDIR variable.
2003-12-30 20:09:00 +00:00
Eelco Dolstra 392b7e0f8e * Fixed a bug in the upgrade operation. 2003-12-23 22:13:36 +00:00
Eelco Dolstra 833f2fc92d * GCC 2.95 compatibility. 2003-12-22 16:40:46 +00:00
Eelco Dolstra cf0287c09e * Upgrade operation in `nix-env'. For instance, you can say
nix-env -u foo.nix strategoxt

  to replace the installed `strategoxt' derivation with the one from `foo.nix', if 
  the latter has a higher version number.  This is a no-op if `strategoxt' is not 
  installed.  Wildcards are also accepted, so

    nix-env -u foo.nix '*'

  will replace any installed derivation with newer versions from `foo.nix', if 
  available.

  The notion of "version number" is somewhat ad hoc, but should be useful in most 
  cases, as evidenced by the following unit tests for the version comparator:

    TEST("1.0", "2.3", -1);
    TEST("2.1", "2.3", -1);
    TEST("2.3", "2.3", 0);
    TEST("2.5", "2.3", 1);
    TEST("3.1", "2.3", 1);
    TEST("2.3.1", "2.3", 1);
    TEST("2.3.1", "2.3a", 1);
    TEST("2.3pre1", "2.3", -1);
    TEST("2.3pre3", "2.3pre12", -1);
    TEST("2.3a", "2.3c", -1);
    TEST("2.3pre1", "2.3c", -1);
    TEST("2.3pre1", "2.3q", -1);

  (-1 = less, 0 = equal, 1 = greater)

* A new verbosity level `lvlInfo', between `lvlError' and `lvlTalkative'.  This is 
  the default for `nix-env', so without any `-v' flags users should get useful 
  output, e.g.,

$ nix-env -u foo.nix strategoxt
upgrading `strategoxt-0.9.2' to `strategoxt-0.9.3'
2003-12-22 16:04:00 +00:00
Eelco Dolstra f3c9783846 * Version numbers can be omitted in install/uninstall. E.g.,
nix-env -i foo.nix subversion

  The version number part of a derivation name is defined as everything following the 
  first dash not followed by a letter.
2003-12-21 23:58:56 +00:00
Eelco Dolstra a81b621202 * -u' -> -e'.
* `--link' / `-l' flag to specify the switch symlink to use (by default, 
  /nix/var/nix/links/current).
2003-12-21 22:34:41 +00:00
Eelco Dolstra 528f1d1867 * Bug fix: parallel builds of the same derivation failed due to lock file removal. 2003-12-21 17:09:16 +00:00
Eelco Dolstra cff6fd22eb * Allow successors that don't exist but have a substitute.
* Integrity: check in successor / substitute registration whether
  the target path exists or has a substitute.
2003-12-05 11:05:19 +00:00
Eelco Dolstra 0d3a1a8582 * Add missing files to `make dist'. 2003-12-02 12:37:37 +00:00
Eelco Dolstra 0c804c6775 * Regression fix: query flags (e.g., "-qsf") were broken. 2003-12-02 10:21:40 +00:00
Eelco Dolstra 078e20885e * Help text for all (non-script) programs, so no more:
$ nix-instantiate --help
error: unknown flag `--help`
Try `nix-instantiate --help' for more information.

:-)
2003-12-01 15:55:05 +00:00
Eelco Dolstra 83ffd4f282 * Fix `make check'. 2003-12-01 14:40:24 +00:00
Eelco Dolstra 5d2b424804 * Use a system name that does not include the OS manufacturer (i.e.,
"i686-linux" instead of "i686-suse-linux").
2003-12-01 14:36:50 +00:00
Eelco Dolstra ba73f94b3b * Another fix. 2003-11-25 13:03:48 +00:00
Eelco Dolstra 66c115ef5f * More `make dist' fixes. 2003-11-25 13:01:21 +00:00
Eelco Dolstra c3ee8c9166 * `make dist' fix. 2003-11-25 12:35:52 +00:00
Eelco Dolstra 6e8c19714a * Allow integer bindings in derivations. 2003-11-25 12:05:48 +00:00
Eelco Dolstra b857267893 * Allow the top-level expression to be a derivation.
* Hack: `nix-env -i *' installs all available derivations.
2003-11-24 11:01:19 +00:00
Eelco Dolstra c9cb1fa21f * Bug fix in path invalidation.
* More consistency checks.
2003-11-24 09:24:52 +00:00
Eelco Dolstra af7e6fe22e * Don't use a hard-coded path. 2003-11-22 21:12:36 +00:00
Eelco Dolstra 9486dda115 * Fix nix-push. 2003-11-22 20:39:51 +00:00
Eelco Dolstra ab0bc4999a * Maintain integrity of the substitute and successor mappings when
deleting a path in the store.
* Allow absolute paths in Nix expressions.
* Get nix-prefetch-url to work again.
* Various other fixes.
2003-11-22 18:45:56 +00:00
Eelco Dolstra 40d9eb14df * Fix the garbage collector. 2003-11-22 15:58:34 +00:00
Eelco Dolstra 7a02d95418 * Remove lock files after building. 2003-11-21 16:05:19 +00:00
Eelco Dolstra 06208d1d86 * Uninstallation. 2003-11-21 14:23:18 +00:00
Eelco Dolstra 2e9042bd1e * Uninstall command (doesn't work yet). 2003-11-20 13:48:48 +00:00
Eelco Dolstra e0b5a492f5 * Installation: add the previously installed packages. Switch to the new
configuration.
* Status queries.
2003-11-19 21:32:03 +00:00
Eelco Dolstra 9898746ef3 * nix-env: a tool to manage user environments.
* Replace all directory reading code by a generic readDirectory()
  function.
2003-11-19 17:27:16 +00:00
Eelco Dolstra fd7ac09f10 * Refactoring (step 2). 2003-11-19 12:03:01 +00:00
Eelco Dolstra ac68840e79 * Refactoring: put the Nix expression evaluator in its own library so
that it can be used by multiple programs.
2003-11-19 11:35:41 +00:00
Eelco Dolstra 2be8b5917a * Use `sdftable -s' to get warnings about the grammar.
* Several bug fixes in the grammar.
* Allow one-line comments (#... and //...) to end in EOF.
2003-11-19 10:04:03 +00:00
Eelco Dolstra dfc9c64ead * "Fix expression" -> "Nix expression".
* More refactoring.
2003-11-18 12:06:07 +00:00
Eelco Dolstra b1117ef29d * nix -> nix-store, fix -> nix-instantiate. 2003-11-18 11:38:25 +00:00
Eelco Dolstra ce92d1bf14 * "Nix expression" -> "store expression".
* More refactoring.
2003-11-18 11:22:29 +00:00
Eelco Dolstra 9f0f020929 * libnix -> libstore. 2003-11-18 10:55:27 +00:00
Eelco Dolstra 8798fae304 * Source tree refactoring. 2003-11-18 10:47:59 +00:00
Eelco Dolstra 45610ae675 * An forward non-random access input iterator class for ATermLists. 2003-11-16 18:31:29 +00:00
Eelco Dolstra 3e5a019a07 * Some utility functions for working with ATerms. 2003-11-16 17:46:31 +00:00
Eelco Dolstra 06ae269c7c * Do not filter when parsing. This is much faster.
* Add some rejections and lexical restrictions to the grammar to make
  this work.
2003-11-10 11:00:38 +00:00
Eelco Dolstra 15801c88fa * Turned the msg() and debug() functions into macros, since they
turned out to be a huge performance bottleneck (the text to printed
  would always be evaluated, even when it was above the verbosity
  level).  This reduces fix-ng execution time by over 50%.

  gprof(1) is very useful. :-)
2003-11-09 10:35:45 +00:00
Eelco Dolstra 90e26d392c * Allow null in derivation bindings. 2003-11-06 15:24:31 +00:00
Eelco Dolstra cfaea07444 * `null' is a nullary primop. 2003-11-06 14:41:49 +00:00
Eelco Dolstra 569e7940f8 * Allow `+' in path names. 2003-11-06 14:41:29 +00:00
Eelco Dolstra fa18f1f184 * Assertions.
* Logical operators (!, &&, ||, ->).
2003-11-05 16:27:40 +00:00
Eelco Dolstra e17e95a828 * Print a shared textual ATerm if the term if very large. Due to
substitutions, Fix terms are very large when printed as trees (in 
  memory, they are quite compact due to sharing).
2003-11-05 16:20:57 +00:00
Eelco Dolstra 80bb477cc4 * Default function arguments. 2003-11-05 15:34:12 +00:00
Eelco Dolstra 0690c1c9c0 * Work around problems with the ATerm library.
The ATerm library doesn't search the heap for pointers to ATerms
  when garbage collecting.  As a result, C++ containers such as
  `map<ATerm, ATerm>' will cause pointer to be hidden from the garbage
  collector, causing crashes.  Instead, we now use ATermTables.
2003-11-03 20:30:40 +00:00
Eelco Dolstra ff31324278 * Ignore options passed to the aterm library. 2003-11-03 18:21:53 +00:00
Eelco Dolstra e2655aa332 * Shorter list syntax ([a b c] instead of [a, b, c]). 2003-11-03 11:59:35 +00:00
Eelco Dolstra ad0976f8d5 * Grammar changes. Attributes in attribute sets are now delimited with
semicolons instead of comma's.  Final semicolon in the set is optional.
2003-11-03 10:21:30 +00:00
Eelco Dolstra 40986312bb * Boolean constants. 2003-11-02 17:36:15 +00:00
Eelco Dolstra adf9a45469 * Primops: baseNameOf, toString. 2003-11-02 16:31:35 +00:00
Eelco Dolstra c8268ca991 * Fast builds. 2003-11-01 23:29:02 +00:00
Eelco Dolstra 7de1b2a698 * Print the exit code of the builder. 2003-11-01 21:11:52 +00:00
Eelco Dolstra 1610444671 * Conditions, string equality. 2003-11-01 19:15:08 +00:00
Eelco Dolstra 1b4184ccbb * Let syntax. 2003-11-01 19:10:41 +00:00
Eelco Dolstra a2a9bacd82 * Filter the substitution list when descending into a recursive
attribute set.
2003-11-01 19:10:19 +00:00
Eelco Dolstra 9210d4d530 * Working evaluator.
* Mutually recursive attribute sets.
* Print evaluator efficiency statistics.
2003-10-31 17:09:31 +00:00
Eelco Dolstra f1c1a3c97f * Allow empty attribute (argument) sets. 2003-10-31 12:21:01 +00:00
Eelco Dolstra 7db08cc924 * Use SGparseString() instead of SGparseFile() because the latter is
buggy.  It fails to clear an internal variable (SG_textIndex)
  between invocations, so it can be called only once during a program
  execution.
2003-10-31 11:22:56 +00:00
Eelco Dolstra 403cb9327f * Factor out evaluation into a separate file. 2003-10-30 16:48:26 +00:00
Eelco Dolstra 9f8f39aa3c * Clean up the imploded parse tree. Quotes around strings are
removed, paths are absolutised relative to the path containing the
  expression we just parsed, and integer literals are converted to
  actual integers.
2003-10-30 16:18:40 +00:00
Eelco Dolstra e537844f4e * Bottomup rewrite function. 2003-10-30 16:11:24 +00:00
Eelco Dolstra 442b09ea33 * Don't use a search path. 2003-10-30 16:10:56 +00:00
Eelco Dolstra 933b3f677d * Attribute selection operator. 2003-10-30 16:10:20 +00:00
Eelco Dolstra b95a3dc45b * Basic grammar and parser for the Fix language. We use libsglr and
friends to do the parsing.  The parse table is embedded in the Fix
  executable using bin2c, which converts an arbitrary file into a C
  character array.
2003-10-29 16:05:03 +00:00
Eelco Dolstra 4d728f6a36 * Forked new version of Fix. 2003-10-29 15:05:18 +00:00
Eelco Dolstra 92eea8fc4e * Fix a race condition in addTextToStore(). 2003-10-23 10:51:55 +00:00
Eelco Dolstra c4e7d324b8 * Use writeFull(). 2003-10-22 13:29:40 +00:00
Eelco Dolstra 9d95aafe8c * Ad hoc per-package logging. When Nix performs a derivation, it now
writes stdout/stderr of the builder to ${prefix}/var/log/nix/x,
  where x is the file name of the derivation expression, e.g.,

    /nix/var/log/nix/54256391624be04fcb426048ae3ea0a4-d-pan-0.14.2.nix

  Note that consecutive builds of the same expression overwrite,
  rather than append to, existing log files.
2003-10-22 11:04:57 +00:00
Eelco Dolstra 143427f90b * Dead code removal. 2003-10-22 10:53:46 +00:00
Eelco Dolstra 4a8948b7a6 * Some wrapper classes to ensure that file descriptors / directory
handles are closed when they go out of scope.
2003-10-22 10:48:22 +00:00
Eelco Dolstra c62433751d * Finished refactoring the tree. 2003-10-20 10:05:01 +00:00
Eelco Dolstra 53e376d836 * Refactored the source tree. 2003-10-20 09:20:11 +00:00
Eelco Dolstra 0791282b2f * Substitutes and nix-pull now work again.
* Fixed a segfault caused by the buffering of stderr.
* Fix now allows the specification of the full output path.  This
  should be used with great care, since it by-passes the normal hash
  generation.
* Incremented the version number to 0.4 (prerelease).
2003-10-16 16:29:57 +00:00
Eelco Dolstra c78bf11524 * Enable buffering of stderr in C++. 2003-10-16 11:55:37 +00:00
Eelco Dolstra f7c7aad135 * Upgraded to Berkeley DB 4.1.25 and do not synchronously flush the
log on commit.  This means that there is a small change that some
  transactions may be rolled back in case of a system crash, but this
  should not be a problem (it merely might cause some expression
  realisations to be rolled back), and it vastly improves performance.

* Upgraded to ATerm 2.0.5 (which also includes Armijn's 64-bit
  patches).
2003-10-16 08:52:44 +00:00
Eelco Dolstra 181aa3dc41 * Don't sort the result of `--query --list'. 2003-10-16 08:06:19 +00:00
Eelco Dolstra ebff82222c * Refactoring: move all database manipulation into store.cc.
* Removed `--query --generators'.
2003-10-15 12:42:39 +00:00
Eelco Dolstra c190f051ac * Automatically recover the database in case of a crash. 2003-10-14 15:33:00 +00:00
Eelco Dolstra 1d61e473c8 * New query `nix --query --predecessors' to print the predecessors of
a Nix expression.
2003-10-10 15:25:21 +00:00
Eelco Dolstra 0abe185688 * `nix --verify': check and repair reverse mapping for successors. 2003-10-10 15:14:29 +00:00
Eelco Dolstra d3d5e77810 * Reverse mappings for the successor and substitute mappings. 2003-10-10 14:46:28 +00:00
Eelco Dolstra 1eb4da156c * Performance improvement: don't register already registered terms,
thus greatly reducing the number of db transactions.
2003-10-10 13:22:29 +00:00
Eelco Dolstra 6baa2c4420 * Get rid of identifiers since they are redundant now. This greatly
simplifies stuff.

* The format of Nix expressions and the database schema changed
  because of this, so it's best to delete old Nix installations.
2003-10-08 15:06:59 +00:00
Eelco Dolstra b9f4942bd2 * string -> Path. 2003-10-07 14:37:41 +00:00
Eelco Dolstra 5d4171f7fb * Synchronise terminology with the ICSE paper (e.g., slice -> closure,
fstate -> Nix expression).
* Fix src/test.cc.
2003-10-07 12:27:49 +00:00
Eelco Dolstra e78f753aa8 * Include the right files in a distribution. 2003-10-02 12:22:19 +00:00
Eelco Dolstra 4193d62e08 * Nix now respects $TMPDIR for the creation of temporary build directories.
* Retry creation of a temporary directory (with a different name) in the 
  case of EEXIST.
2003-10-02 11:55:38 +00:00
Eelco Dolstra 1c7d6bf5fc * Removed references to char_traits so that boost/format also works on
GCC 2.95.
2003-09-11 10:23:55 +00:00
Eelco Dolstra d930a9bc5a * Added some missing #includes. 2003-09-11 08:31:29 +00:00
Eelco Dolstra 803a924b77 * Make nicer dot graphs. Also show the inner structure of slices. 2003-09-03 14:49:58 +00:00
Eelco Dolstra c0bbed0959 * Factored out dot graph generation into a separate file. 2003-09-03 11:20:18 +00:00
Eelco Dolstra 0d2bc68681 * Do not show the output of the builder unless the verbosity is at
least at debug level (-vvv).  The output is still appended to the 
  build log in /nix/var/log/nix.
2003-08-29 13:12:30 +00:00
Eelco Dolstra b018517314 * Do not try to remove write permission from symlinks, since chmod()
follows symlinks.  (Note that the permissions on symlinks are
  ignored anyway.)
2003-08-28 10:51:14 +00:00
Eelco Dolstra 31be53cd0a * Fix the atrocious (exponential? factorial?) time complexity in
`nix --query --requisites'.
2003-08-25 14:56:11 +00:00
Eelco Dolstra a88144215c * Remove write permission from output paths after they have been built.
* Point $HOME to a non-existing path when building to prevent certain tools (such as 
  wget) from falling back on /etc/passwd to locate the home directory (which we 
  don't want them to look at since it's not declared as an input).
2003-08-22 20:12:44 +00:00
Eelco Dolstra 956801fcc2 * Use maps and sets in the FState data type. This ensures normalisation of
slices and derivations w.r.t. order of paths, slice elements, etc.
2003-08-20 14:11:40 +00:00
Eelco Dolstra 624c48260f * Change the abstract syntax of slices. It used to be that ids were used as
keys to reference slice elements, e.g.,

    Slice(["1ef7..."], [("/nix/store/1ef7...-foo", "1ef7", ["8c99..."]), ...])

  This was wrong, since ids represent contents, not locations.  Therefore we
  now have:

    Slice(["/nix/store/1ef7..."], [("/nix/store/1ef7...-foo", "1ef7", ["/nix/store/8c99-..."]), ...])

* Fix a bug in the computation of slice closures that could cause slice
  elements to be duplicated.
2003-08-20 12:39:56 +00:00
Eelco Dolstra ed0db2e0d8 * Fixed a serious bug in the computation of slices. Sometimes the slices
would not be properly closed under the path reference relation.
2003-08-20 11:30:45 +00:00
Eelco Dolstra 1472cc4825 * Pipe /dev/null into stdin. 2003-08-19 13:07:38 +00:00
Eelco Dolstra 2de8504791 * Delete the temporary directories of failed builds by default, and an
option `--keep-failed' to override this behaviour.
2003-08-19 09:04:47 +00:00
Eelco Dolstra 31e4aa6439 * Allow lists in package bindings, e.g.,
("srcs", [Relative("foo/bar.c"), Relative("foo/baz.h")])

  The result is an environment variable that contains the path names of the
  inputs separated by spaces (so this is not safe for values containing
  spaces).
2003-08-18 16:32:55 +00:00
Eelco Dolstra ebbb6ce578 * Most shells initialise PATH to some default (/bin:/usr/bin:...)
when PATH is not set.  We don't want this, so fill it in with
  some dummy value.
2003-08-18 14:54:54 +00:00
Eelco Dolstra 96c7b98bf0 * Argument support in Fix. Arguments can be passed through the
builder using the `args' binding:

  ("args", ["bla", True, IncludeFix("aterm/aterm.fix")])

  Note that packages can also be declared as inputs by specifying them
  in the argument list.
2003-08-15 13:01:45 +00:00
Eelco Dolstra 555347744d * Derivation expressions now can specify arguments to be passed to the
builder.  Note that this unfortunately causes all Fix-computed
  hashes to change.
2003-08-15 12:32:37 +00:00
Eelco Dolstra 163db7367f * Fix can now read expressions from stdin (by saying `fix -'). 2003-08-15 09:21:19 +00:00
Eelco Dolstra dc0ef2ca98 * Detect infinite loops using blackholing. 2003-08-14 12:37:31 +00:00
Eelco Dolstra 5cde23f869 * Function() takes a list of formals. 2003-08-14 09:49:31 +00:00
Eelco Dolstra 0a2de7f543 * Lam -> Function. Doh! 2003-08-14 09:29:07 +00:00
Eelco Dolstra c602930e08 * deletePath(): some operating systems (e.g., Mac OS X) don't like it
when we delete entries from a directory while we are reading it.
  So read the directory into memory, then delete its contents.
2003-08-08 14:55:56 +00:00
Eelco Dolstra 236eb59293 * Allow locks on paths to be acquired recursively (that is, if the
process is already holding a lock on a path, it may acquire the lock
  again without blocking or failing).  (This might be dangerous, not
  sure).  Necessary for fast builds to work.
2003-08-06 09:34:04 +00:00
Eelco Dolstra 720f06e3b0 * A flag `--flat' to just compute the MD5 checksum of the contents of
a regular file.  I.e., `nix-hash --flat' is equivalent to the
  coreutils `md5sum' command (which doesn't exist on all systems).
2003-08-06 09:06:32 +00:00
Eelco Dolstra 37483672d4 * App -> Call.
* Allow booleans in package environment bindings (True maps to "1",
  False maps to "").
2003-08-06 09:05:04 +00:00
Eelco Dolstra d34b4d4f28 * Conditionals. 2003-08-05 13:05:30 +00:00
Eelco Dolstra 4ce652640b * Cache result of fstatePaths(). TODO: do this in fstore.cc. 2003-08-05 12:29:47 +00:00
Eelco Dolstra 17f05dba77 * Allow the top-level expression to be a list of expressions that
normalise to Nix expression.
2003-08-05 11:13:38 +00:00