Commit graph

6575 commits

Author SHA1 Message Date
Eelco Dolstra
13b089c890 * Also kill all processes of the build user after the build. This is
critical to prevent certain kinds of 0wnage.
2005-10-17 17:43:21 +00:00
Eelco Dolstra
f1b3a418fa * Before starting a build under some uid, kill all current processes
running under that uid.
2005-10-17 17:35:37 +00:00
Eelco Dolstra
439823ae80 * Check that the build result is owned by the build user, and that
nobody else has write permission to the build result.  This catches
  most hack attempts.
2005-10-17 16:59:25 +00:00
Eelco Dolstra
7ef574e5d0 * Don't use FIFOs to make Nix create the output path on behalf of the
builder.  Instead, require that the Nix store has sticky permission
  (S_ISVTX); everyone can created files in the Nix store, but they
  cannot delete, rename or modify files created by others.
2005-10-17 16:52:29 +00:00
Eelco Dolstra
32282abcea * Beginning of secure multi-user Nix stores. If Nix is started as
root (or setuid root), then builds will be performed under one of
  the users listed in the `build-users' configuration variables.  This
  is to make it impossible to influence build results externally,
  allowing locally built derivations to be shared safely between
  users (see ASE-2005 paper).

  To do: only one builder should be active per build user.
2005-10-17 15:33:24 +00:00
Eelco Dolstra
dfbf520ec2 * Swap the system and version comparion columns. 2005-10-06 15:51:59 +00:00
Eelco Dolstra
cec2be64f3 * Only colorise if we are attached to a terminal. 2005-10-06 15:01:46 +00:00
Eelco Dolstra
b87b9c0d1f * New query option: --compare-versions' or -c' to compare installed
versions to available versions, or vice versa.

  For example, the following compares installed versions to available
  versions:

    $ nix-env -qc
    autoconf-2.59            = 2.59
    automake-1.9.4           < 1.9.6
    f-spot-0.0.10            - ?
    firefox-1.0.4            < 1.0.7
    ...

  I.e., there are newer versions available (in the current default Nix
  expression) for Automake and Firefox, but not for Autoconf, and
  F-Spot is missing altogether.

  Conversely, the available versions can be compared to the installed
  versions:

    $ nix-env -qac
    autoconf-2.59                  = 2.59
    automake-1.9.6                 > 1.9.4
    bash-3.0                       - ?
    firefox-1.0.7                  > 1.0.4
    ...

  Note that bash is available but no version of it is installed.

  If multiple versions are available for comparison, then the highest
  is used.  E.g., if Subversion 1.2.0 is installed, and Subversion
  1.1.4 and 1.2.3 are available, then `nix-env -qc' will print `<
  1.2.3', not `> 1.1.4'.

  If higher versions are available, the version column is printed in
  red (using ANSI escape codes).
2005-10-06 14:44:54 +00:00
Eelco Dolstra
0e38578433 * log2xml -> nix-log2xml. 2005-10-05 09:42:13 +00:00
Eelco Dolstra
d47e03fccd * Install the XSL stylesheets for log to html conversion. 2005-10-05 09:37:58 +00:00
Eelco Dolstra
ebfe57166d * Lets not go wild with templates. 2005-09-22 17:23:43 +00:00
Eelco Dolstra
4578a490ce * Parse multi-valued options. 2005-09-22 15:43:22 +00:00
Eelco Dolstra
8d06842a76 * Configuration options for trusted local builds. 2005-09-21 12:19:39 +00:00
Eelco Dolstra
ef9e2c8e73 * Typo. 2005-09-20 16:14:00 +00:00
Eelco Dolstra
ed1db42915 * List concatenation must be right-associative for efficiency. 2005-09-14 11:41:59 +00:00
Eelco Dolstra
cf2bb91ec8 * Missing #include. 2005-09-13 13:17:01 +00:00
Eelco Dolstra
2bcd65ecf6 * `nix-env -e' corrupts memory due to incorrect use of iterators.
Reported by Rob Vermaas.
2005-09-01 18:14:04 +00:00
Eelco Dolstra
e1a6fb7870 * `dependencyClosure' now allows a search path, e.g.,
dependencyClosure { ... searchPath = [ ../foo ../bar ]; ... }

* Primop `dirOf' to return the directory part of a path (e.g., dirOf
  /a/b/c == /a/b).

* Primop `relativise' (according to Webster that's a real word!) that
  given paths A and B returns a string representing path B relative
  path to A; e.g., relativise /a/b/c a/b/x/y => "../x/y".
2005-08-14 14:00:39 +00:00
Eelco Dolstra
08c53923db * A primitive operation `dependencyClosure' to do automatic dependency
determination (e.g., finding the header files dependencies of a C
  file) in Nix low-level builds automatically.

  For instance, in the function `compileC' in make/lib/default.nix, we
  find the header file dependencies of C file `main' as follows:

    localIncludes =
      dependencyClosure {
        scanner = file:
          import (findIncludes {
            inherit file;
          });
        startSet = [main];
      };

  The function works by "growing" the set of dependencies, starting
  with the set `startSet', and calling the function `scanner' for each
  file to get its dependencies (which should yield a list of strings
  representing relative paths).  For instance, when `scanner' is
  called on a file `foo.c' that includes the line

    #include "../bar/fnord.h"

  then `scanner' should yield ["../bar/fnord.h"].  This list of
  dependencies is absolutised relative to the including file and added
  to the set of dependencies.  The process continues until no more
  dependencies are found (hence its a closure).

  `dependencyClosure' yields a list that contains in alternation a
  dependency, and its relative path to the directory of the start
  file, e.g.,

    [ /bla/bla/foo.c
      "foo.c"
      /bla/bar/fnord.h
      "../bar/fnord.h"
    ]

  These relative paths are necessary for the builder that compiles
  foo.c to reconstruct the relative directory structure expected by
  foo.c.

  The advantage of `dependencyClosure' over the old approach (using
  the impure `__currentTime') is that it's completely pure, and more
  efficient because it only rescans for dependencies (i.e., by
  building the derivations yielded by `scanner') if sources have
  actually changed.  The old approach rescanned every time.
2005-08-14 12:38:47 +00:00
Eelco Dolstra
0399365675 * nix-hash: option `--truncate' to truncate the hash to 160 bits. Hmm,
kind of ad hoc ;-)
2005-08-14 10:09:56 +00:00
Eelco Dolstra
c680f835c9 * Escape ASCII characters < 32 to Unicode FFFD (REPLACEMENT CHARACTER)
so that we don't produce un-wellformed XML.
2005-08-01 13:39:19 +00:00
Eelco Dolstra
f450c8ea2f * Oops. XSL stylesheet to mark errors. 2005-08-01 13:24:04 +00:00
Eelco Dolstra
800a6ff845 * Mark error lines in red, and expand subtrees containing errors
automatically.
2005-08-01 13:23:43 +00:00
Eelco Dolstra
991a130b1e * Added a list concatenation operator:
[1 2 3] ++ [4 5 6] => [1 2 3 4 5 6]
2005-07-25 15:05:34 +00:00
Eelco Dolstra
4c20a08293 * Build dynamic libraries. 2005-07-22 14:52:45 +00:00
Eelco Dolstra
0f827cc607 * Prevent repeated wrapping of closed terms
(closed(closed(closed(...)))) since this reduces performance by
  producing bigger terms and killing caching (which incidentally also
  prevents useful infinite recursion detection).
2005-07-19 11:48:05 +00:00
Eelco Dolstra
2135e7c041 * Wat cleanups. 2005-07-16 23:19:20 +00:00
Eelco Dolstra
6f82a78de7 * Define paths using regexps, as is done in the Flex definition. 2005-07-16 21:38:15 +00:00
Eelco Dolstra
6f91f02f75 * Make the rejects a bit more compact.
* Add lexical restrictions for keywords.
2005-07-16 20:43:58 +00:00
Eelco Dolstra
9590009a74 * Fix ambiguity. 2005-07-16 15:41:27 +00:00
Eelco Dolstra
f797cb5855 * Revive and update the SDF grammar for Nix expressions. 2005-07-16 14:07:35 +00:00
Eelco Dolstra
22d3587f3b * In nix-instantiate, at top-level, call functions that have arguments
with default values automatically.  I.e., e -> e {}.

  This feature makes convenience expressions such as
  pkgs/system/i686-linux.nix in Nixpkgs obsolete, since we can just do

  $ nix-instantiate ./pkgs/system/all-packages.nix

  since all-packages.nix takes a single argument (system) that has a
  default value (__thisSystem).
2005-07-12 16:06:25 +00:00
Eelco Dolstra
040140dd1c * Added a primop `removeAttrs' to remove attributes from a set, e.g.,
`removeAttrs attrs ["x", "y"]' returns the set `attrs' with the
  attributes named `x' and `y' removed.  It is not an error for the
  named attributes to be missing from the input set.
2005-05-18 17:19:21 +00:00
Eelco Dolstra
109cde6706 * Ignore (with a warning) invalid garbage collector roots. 2005-05-10 14:56:10 +00:00
Eelco Dolstra
456f3251d2 * Typo. 2005-05-10 14:21:46 +00:00
Eelco Dolstra
9ec7e58aa4 * Handle store path arguments in `nix-env -i' correctly again. 2005-05-09 17:55:35 +00:00
Eelco Dolstra
8f57634c14 * Automatically upgrade the Berkeley DB environment if necessary. 2005-05-09 15:25:47 +00:00
Eelco Dolstra
edd145d2fb * Lazily compute the derivation and output paths of derivations. This
makes most query and installation operations much faster (e.g.,
  `nix-env -qa' on the current Nixpkgs is about 10 times faster).
2005-05-08 10:32:09 +00:00
Eelco Dolstra
426593162e * ATermMap needs an assignment operator, otherwise we are screwed. 2005-05-08 10:28:19 +00:00
Eelco Dolstra
77557a6f06 Commit 3000!
* Make the `derivation' primitive much more lazy.  The expression
  `derivation attrs' now evaluates to (essentially)

    attrs // {
      type = "derivation";
      outPath = derivation! attrs;
      drvPath = derivation! attrs;
    }

  where `derivation!' is a primop that does the actual derivation
  instantiation (i.e., it does what `derivation' used to do).  The
  advantage is that it allows commands such as `nix-env -qa' and
  `nix-env -i' to be much faster since they no longer need to
  instantiate all derivations, just the `name' attribute.  (However,
  `nix-env' doesn't yet take advantage of this since it still always
  evaluates the `outPath' and `drvPath' attributes).

  Also, this allows derivations to cyclically reference each other,
  for example,

    webServer = derivation {
      ...
      hostName = "svn.cs.uu.nl";
      services = [svnService];
    };

    svnService = derivation {
      ...
      hostName = webServer.hostName;
    };

  Previously, this would yield a black hole (infinite recursion).
2005-05-07 21:48:49 +00:00
Eelco Dolstra
6057b51835 * Don't try to register GC roots in read-only mode. 2005-05-07 21:33:31 +00:00
Eelco Dolstra
52a2f41320 * Include some required header files. 2005-05-04 16:33:20 +00:00
Eelco Dolstra
26fd28432d * FreeBSD 4.x doesn't have stdint.h, use inttypes.h instead (which is
also part of ISO C).
2005-05-04 16:32:54 +00:00
Eelco Dolstra
5dea0622d1 * Idem (constness fix).
* `compare' in GCC 2.95 is broken.
2005-05-04 16:31:49 +00:00
Eelco Dolstra
4a266e35d4 * GCC 2.95 compatibility fix in constness; strangely, I think this
should not have worked at all.
2005-05-04 16:31:24 +00:00
Eelco Dolstra
d7b3cdbd91 * GCC 2.95 compatibility. Prevents internal compiler error in member
template friends.
2005-05-04 16:30:35 +00:00
Eelco Dolstra
ae6d9033a1 * The eof() state isn't guaranteed to be set non-lazily. GCC 2.95
compatibility fix.
2005-05-04 16:29:44 +00:00
Eelco Dolstra
02f2da0142 * Merging from nix-make branch:
- Add __currentTime primitive (dangerous!).
  - Allow imports of derivations.
2005-05-02 14:44:58 +00:00
Eelco Dolstra
f913283570 * Remove redundant message. 2005-04-13 09:20:27 +00:00
Eelco Dolstra
f3660b1c8c * Garbage collector fix: allow deletion of paths that have invalid
(but substitutable) referers.
2005-04-12 10:51:00 +00:00
Eelco Dolstra
cab7816b56 * Slightly nicer message. 2005-04-11 08:07:41 +00:00
Eelco Dolstra
c9c58dba55 * Primop `__currentSystem' to return the current platform identifier. 2005-04-10 17:38:19 +00:00
Eelco Dolstra
c702dfca3f * nix-store: --substitute' -> --register-substitutes'. 2005-04-08 13:48:41 +00:00
Eelco Dolstra
4271385a73 * Make `nix-store --query --tree' work on non-derivations (i.e., on
any store path).
2005-04-08 12:57:16 +00:00
Eelco Dolstra
10c429c757 * If store paths are specified as sources in Nix expressions, don't
copy them, but use them directly.
2005-04-07 14:35:01 +00:00
Eelco Dolstra
f9848d4f31 * Support base-32 hash representations. 2005-04-07 14:33:32 +00:00
Eelco Dolstra
c815aff21b * `nix-store --add-fixed' to preload the outputs of fixed-output
derivations.  This is mostly to simplify the implementation of
  nix-prefetch-{url, svn}, which now work properly in setuid
  installations.

* Enforce valid store names in `nix-store --add / --add-fixed'.
2005-04-07 14:01:51 +00:00
Eelco Dolstra
6f788880b6 * Re-enable dot graph generation. 2005-03-26 22:06:57 +00:00
Eelco Dolstra
298dd487bb * When finding live paths, the deriver need not be valid. 2005-03-25 14:31:12 +00:00
Eelco Dolstra
7eaf038763 * `nix-store --verify': repair bad referer mappings. 2005-03-25 14:21:49 +00:00
Eelco Dolstra
c6178f0b03 * Create missing log and temproots directories automatically (reported
by Rob).
2005-03-24 17:46:38 +00:00
Eelco Dolstra
cff6bc06df * Fix endianness bug. 2005-03-23 19:18:22 +00:00
Eelco Dolstra
0df9f08078 * Export the references graph to the build hook. 2005-03-23 13:16:36 +00:00
Eelco Dolstra
3f236f01ae * `nix-store --register-validity': allow a path to refer to a path
listed later in the list of new valid paths.
2005-03-23 13:07:28 +00:00
Eelco Dolstra
a04c62e0c4 * Canonicalise path meta-data in `nix-store --register-validity'. 2005-03-23 12:06:57 +00:00
Eelco Dolstra
f20f081560 * nix-store: --isvalid' -> --check-validity', `--validpath' ->
`--register-validity'.
* `nix-store --register-validity': read arguments from stdin, and
  allow the references and deriver to be set.
2005-03-23 11:25:20 +00:00
Eelco Dolstra
c757d16c8c * Bug in clearSubstitutes(). 2005-03-14 18:54:40 +00:00
Eelco Dolstra
08df443618 * Check for duplicate attributes and formal parameters in Nix
expressions.
2005-03-10 11:33:46 +00:00
Eelco Dolstra
4bbdcfbb45 * Don't use fork() in copyPath(), but a string buffer. 2005-03-03 13:58:02 +00:00
Eelco Dolstra
86cb3cc554 * Increase Berkeley DB limits a bit more.
* Maintain the cleanup invariant in clearSubstitutes().
2005-03-03 13:10:44 +00:00
Eelco Dolstra
07b4399fb6 * `nix-store -q --hash' to quickly query the hash of the contents of a
store path (which is stored in the database).
2005-03-02 15:57:06 +00:00
Eelco Dolstra
bfaf83a0fd * When multiple derivations are specified in `nix-store -r', don't
continue building when one fails unless `--keep-going' is
  specified.
* When `--keep-going' is specified, print out the set of failing
  derivations at the end (otherwise it can be hard to find out which
  failed).
2005-02-23 11:19:27 +00:00
Eelco Dolstra
3a2c3f0cf2 * Support for fixed-output hashes over directory trees (i.e., over the
NAR dump of the path).
2005-02-22 21:14:41 +00:00
Eelco Dolstra
eda2c3c253 * Compatibility hack so that Nixpkgs can continue to do hash checking
in `fetchurl' in Nix <= 0.7, but doesn't in Nix 0.8.
2005-02-22 15:23:24 +00:00
Eelco Dolstra
3c1630131e * Subtle bug in the builder: if a subgoal that is instantiated
multiple times is also a top-level goal, then the second and later
  instantiations would never be created because there would be a
  stable pointer to the first one that would keep it alive in the
  WeakGoalMap.
* Some tracing code for debugging this kind of problem.
2005-02-18 09:50:20 +00:00
Eelco Dolstra
e0181f56be * `nix-store -q --tree' shows a tree representing the dependency graph
of the given derivation.  Useful for getting a quick overview of how
  something was built.  E.g., to find out how the `baffle' program in
  your user environment was built, you can do

    $ nix-store -q --tree $(nix-store -qd $(which baffle))

  Tree nesting depth is minimised (?) by topologically sorting paths
  under the relation A < B iff A \in closure(B).
2005-02-17 15:57:46 +00:00
Eelco Dolstra
74ab0695b5 * Compatibility hack with older user environments. 2005-02-17 15:48:50 +00:00
Eelco Dolstra
8a3a96dd5b * Switch to the calling user context for some more operations in a
setuid installation.
2005-02-17 13:55:18 +00:00
Eelco Dolstra
88273f9574 * Put build logs in $prefix/var/nix/log/drvs/. 2005-02-17 13:54:45 +00:00
Eelco Dolstra
202d5bbda5 * Compatibility with older GCCs. 2005-02-15 12:05:47 +00:00
Eelco Dolstra
e17910cfb5 * And yet another installation source: the ability to copy user
environment elements from one user environment to another, e.g.,

    $ nix-env -i --from-profile /nix/var/nix/profiles/other-profile aterm
    
  copies the `aterm' component installed in the `other-profile' to the
  user's current profile.
2005-02-15 10:49:31 +00:00
Eelco Dolstra
8992fce3da * It is now possible to add store derivations or paths directly to a
user environment, e.g.,

    $ nix-env -i /nix/store/z58v41v21xd3ywrqk1vmvdwlagjx7f10-aterm-2.3.1.drv

  or 

    $ nix-env -i /nix/store/hsyj5pbn0d9iz7q0aj0fga7cpaadvp1l-aterm-2.3.1

  This is useful because it allows Nix expressions to be bypassed
  entirely.  For instance, if only a nix-pull manifest is provided,
  plus the top-level path of some component, it can be installed
  without having to supply the Nix expression (e.g., for obfuscation,
  or to be independent of Nix expression language changes or context
  dependencies).
2005-02-14 17:35:10 +00:00
Eelco Dolstra
e446d342b7 * Added an installation source --from-expression' (or -E') to
install derivations from a Nix expression specified on the command
  line.  This is particularly useful for disambiguation if there are
  multiple derivations with the same name.  For instance, in Nixpkgs,
  to install the Firefox wrapper rather than the plain Firefox
  component:

    $ nix-env -f .../i686-linux.nix -i -E 'x: x.firefoxWrapper'

  The Nix expressions should be functions to which the default Nix
  expression (in this case, `i686-linux.nix') is passed, hence `x:
  ...'.

  This might also be a nice way to deal with high-level (user-level)
  variability, e.g.,

    $ nix-env -f ./server.nix -i -E 'x: x {port = 8080; ssl = false;}'
2005-02-14 17:07:43 +00:00
Eelco Dolstra
0cb016c209 * Refactoring. Hope this doesn't break the semantics of `-u' ;-) 2005-02-14 16:16:02 +00:00
Eelco Dolstra
a04a5de8f7 * Implement the `gc-keep-derivations' global configuretion flag. 2005-02-14 14:16:56 +00:00
Eelco Dolstra
6a8ef36fe6 * Global configuration option `env-keep-derivations' to store pointer
to derivations in user environments.  Nice for developers (since it
  prevents build-time-only dependencies from being GC'ed, in
  conjunction with `gc-keep-outputs').  Turned off by default.
2005-02-14 13:07:09 +00:00
Eelco Dolstra
b0aba6ec2a * Don't keep the derivation symlink when creating profile generations. 2005-02-14 10:44:57 +00:00
Eelco Dolstra
32429142cd * Type error in constructor call (caught by GCC 3.3, but not 3.4!). 2005-02-14 09:53:11 +00:00
Eelco Dolstra
20ce2642fc * Refactoring to support different installation sources in nix-env.
* Set the references for the user environment manifest properly.
* Don't copy the manifest (this was accidental).
* Don't store derivation paths in the manifest (maybe this should be
  made optional).  This cleans up the semantics of nix-env, which were
  weird.
* Hash on the output paths of activated components, not on derivation
  paths.  This is because we don't know the derivation path of already
  installed components anymore, and it allows the installation of
  components by store path (skipping Nix expressions entirely).
* Query options `--out-path' and `--drv-path' to show the output and
  derivation paths of components, respectively (the latter replaces
  the `--expr' query).
2005-02-11 16:56:45 +00:00
Eelco Dolstra
80870d9291 * Input sources should be in the set of all referenceable paths too. 2005-02-11 16:03:47 +00:00
Eelco Dolstra
3a99616968 * Commit more often to prevent out-of-memory errors. 2005-02-09 14:37:24 +00:00
Eelco Dolstra
98df735b51 * Propagate the deriver of a path through the substitute mechanism.
* Removed some dead code (successor stuff) from nix-push.
* Updated terminology in the tests (store expr -> drv path).
* Check that the deriver is set properly in the tests.
2005-02-09 12:57:13 +00:00
Eelco Dolstra
582e01c06f * Automatically upgrade <= 0.7 Nix stores to the new schema (so that
existing user environments continue to work).
* `nix-store --verify': detect incomplete closures.
2005-02-09 09:50:29 +00:00
Eelco Dolstra
c547439843 * Subflag in --verify': nix-store --verify --check-contents' checks
that the contents of store paths has not changed by comparing hashes
  of their current contents to the hashes stored in the database.
2005-02-08 13:48:53 +00:00
Eelco Dolstra
3d74274b37 * Updated `nix-store --verify' to the new schema. 2005-02-08 13:23:55 +00:00
Eelco Dolstra
fbc434ee4c * `nix-store -qb' to query derivation environment bindings. Useful
for finding build-time dependencies (possibly after a build).  E.g.,

    $ nix-store -qb aterm $(nix-store -qd $(which strc))
    /nix/store/jw7c7s65n1gwhxpn35j9rgcci6ilzxym-aterm-2.3.1

* Arguments to nix-store can be files within store objects, e.g.,
  /nix/store/jw7c...-aterm-2.3.1/bin/baffle.

* Idem for garbage collector roots.
2005-02-07 14:32:44 +00:00
Eelco Dolstra
450c358e20 * Maintain a database table (`derivers') that maps output paths to the
derivation that produced them.
* `nix-store -qd PATH' prints out the derivation that produced a path.
2005-02-07 13:40:40 +00:00
Eelco Dolstra
a37338815d * A GC setting `gc-keep-outputs' to specify whether output paths of
derivations should be kept.
2005-02-01 22:07:48 +00:00
Eelco Dolstra
65b6c8ab4c * Move root finding from nix-collect-garbage' to nix-store --gc'.
This was necessary becase root finding must be done after
  acquisition of the global GC lock.

  This makes `nix-collect-garbage' obsolete; it is now just a wrapper
  around `nix-store --gc'.

* Automatically remove stale GC roots (i.e., indirect GC roots that
  point to non-existent paths).
2005-02-01 15:05:32 +00:00
Eelco Dolstra
630ae0c9d7 * nix-build: use an indirection scheme to make it easier for users to
get rid of GC roots.  Nix-build places a symlink `result' in the
  current directory.  Previously, removing that symlink would not
  remove the store path being linked to as a GC root.  Now, the GC
  root created by nix-build is actually a symlink in
  `/nix/var/nix/gcroots/auto' to `result'.  So if that symlink is
  removed the GC root automatically becomes invalid (since it can no
  longer be resolved).  The root itself is not automatically removed -
  the garbage collector should delete dangling roots.
2005-02-01 13:48:46 +00:00
Eelco Dolstra
dcc37c236c * nix-store, nix-instantiate: added an option `--add-root' to
immediately add the result as a permanent GC root.  This is the only
  way to prevent a race with the garbage collector.  For instance, the
  old style

    ln -s $(nix-store -r $(nix-instantiate foo.nix)) \
      /nix/var/nix/gcroots/result

  has two time windows in which the garbage collector can interfere
  (by GC'ing the derivation and the output, respectively).  On the
  other hand,

    nix-store --add-root /nix/var/nix/gcroots/result -r \
      $(nix-instantiate --add-root /nix/var/nix/gcroots/drv \
        foo.nix)

  is safe.

* nix-build: use `--add-root' to prevent GC races.
2005-02-01 12:36:25 +00:00
Eelco Dolstra
06b4424286 * Add missing files to dist.
* Fix GC and substitute bugs related to self-references.  Add a
  regression test.
2005-02-01 09:23:38 +00:00
Eelco Dolstra
32fa82a56a * Acquire a global GC lock to prevent new temporary root files from
being created after the garbage collector has read the temproots
  directory.  This blocks the creation of new processes, but the
  garbage collector could periodically release the GC lock to allow
  them to run.
2005-01-31 22:23:49 +00:00
Eelco Dolstra
89c9bc11ab * Add a test for a more subtle race: a process starting after the
temporary root files have been read but creating outputs before the
  store directory has been read.
2005-01-31 22:01:55 +00:00
Eelco Dolstra
207bdcbe86 * Automatically remove temporary root files. 2005-01-31 21:20:59 +00:00
Eelco Dolstra
252c9c91ab * Topologically sort paths under the references relation to ensure
that they are deleted in an order that maintains the closure
  invariant.
* Presence of a path in a temporary roots file does not imply that all
  paths in its closure are also present, so add the closure.
2005-01-31 14:00:43 +00:00
Eelco Dolstra
33c5d23b81 * Don't delete active lock files. 2005-01-31 12:19:53 +00:00
Eelco Dolstra
1328aa3307 * Start of concurrent garbage collection. Processes write temporary
roots to a per-process temporary file in /nix/var/nix/temproots
  while holding a write lock on that file.  The garbage collector
  acquires read locks on all those files, thus blocking further
  progress in other Nix processes, and reads the sets of temporary
  roots.
2005-01-31 10:27:25 +00:00
Eelco Dolstra
22cfdfa246 * Use NIX_STORE environment variable to locate the store (in addition
to NIX_STORE_DIR) so that Nix invocations in builders in `make
  check' work correctly if the store doesn't exist.
2005-01-28 13:19:16 +00:00
Eelco Dolstra
0ea8b6993a * Only invalidate paths when they are in fact valid. 2005-01-28 11:05:46 +00:00
Eelco Dolstra
a85d1849af * Missing dependency; only a problem when building from Subversion. 2005-01-27 19:00:48 +00:00
Eelco Dolstra
8a3eef22e3 * Fix deadlock. 2005-01-27 17:48:14 +00:00
Eelco Dolstra
c60a4943ba * Update referers mappings when updating/clearing the references
mapping.
* Do things in the right order in invalidatePath().
2005-01-27 16:18:39 +00:00
Eelco Dolstra
c505702265 * Fix and simplify the garbage collector (it's still not concurrent,
though).  In particular it's now much easier to register a GC root.
  Just place a symlink to whatever store path it is that you want to
  keep in /nix/var/nix/gcroots.
2005-01-27 15:21:29 +00:00
Eelco Dolstra
59682e6188 * Make lock removal safe by signalling to blocked processes that the
lock they are waiting on has become stale (we do this by writing a
  meaningless token to the unlinked file).
2005-01-27 12:19:25 +00:00
Eelco Dolstra
a24b78e9f1 * Maintain the references/referers relation also for derivations.
This simplifies garbage collection and `nix-store --query
  --requisites' since we no longer need to treat derivations
  specially.

* Better maintaining of the invariants, e.g., setReferences() can only
  be called on a valid/substitutable path.
2005-01-25 21:28:25 +00:00
Eelco Dolstra
2a2756b856 * Simplification: registerSubstitutes -> registerSubstitute. We no
longer need the former since there we no longer have the
  substitutes-rev table (which triggered a O(n^2) cost in updating
  them).
2005-01-25 20:27:40 +00:00
Eelco Dolstra
066da4ab85 * Really fix the substitute mechanism, i.e., ensure the closure
invariant by registering references through the manifest.
* Added a test for nix-pull.
2005-01-25 17:08:52 +00:00
Eelco Dolstra
c6290e42bc * Fix the `--fallback' switch.
* Fix the substitutes tests.
2005-01-25 13:00:12 +00:00
Eelco Dolstra
581fc47783 * Fix the build hook mechanism; pass the pointer graph to the hook. 2005-01-25 11:55:43 +00:00
Eelco Dolstra
52bf9b86bb * In nix-store: added query `--referers-closure' that returns the
closure of the referers relation rather than the references
  relation, i.e., the set of all paths that directly or indirectly
  refer to the given path.  Note that contrary to the references
  closure this set is not fixed; it can change as paths are added to
  or removed from the store.
2005-01-25 11:18:03 +00:00
Eelco Dolstra
80faa2f98a * In nix-store: change --build' back to --realise'. Also brought
back the query flag `--force-realise'.
* Fixed some of the tests.
2005-01-25 10:55:33 +00:00
Eelco Dolstra
6a0a2d5593 * Terminology fixes. 2005-01-20 16:01:07 +00:00
Eelco Dolstra
6bb5efadec * Ensure that derivation names and sources don't end in `.drv'. 2005-01-20 15:25:01 +00:00
Eelco Dolstra
05f0430de1 * Another change to low-level derivations. The last one this year, I
promise :-) This allows derivations to specify on *what* output
  paths of input derivations they are dependent.  This helps to
  prevent unnecessary downloads.  For instance, a build might be
  dependent on the `devel' and `lib' outputs of some library
  component, but not the `docs' output.
2005-01-20 14:10:19 +00:00
Eelco Dolstra
e0f4e587c3 * Nix-store queries --references' and referers' to query the pointer
graph.  That is, `nix-store --query --references PATH' shows the set
  of paths referenced by PATH, and `nix-store --query --referers PATH'
  shows the set of paths referencing PATH.
2005-01-19 16:59:56 +00:00
Eelco Dolstra
96de272b48 * Renamed normalise.cc' -> build.cc', `storeexprs.cc' ->
`derivations.cc', etc.
* Store the SHA-256 content hash of store paths in the database after
  they have been built/added.  This is so that we can check whether
  the store has been messed with (a la `rpm --verify').
* When registering path validity, verify that the closure property
  holds.
2005-01-19 16:39:47 +00:00
Eelco Dolstra
ef5f254a55 * `nix-store --build' now builds its arguments in parallel instead of
sequentially (within the limits set by `--jobs').  This should
  greatly improve the utilisation of the build farm when doing Nixpkgs
  builds.
2005-01-19 15:02:02 +00:00
Eelco Dolstra
06c77bf7a8 * Change extension .store' to .drv'.
* Re-enable `nix-store --query --requisites'.
2005-01-19 14:36:00 +00:00
Eelco Dolstra
863dcff6c5 * Started removing closure store expressions, i.e., the explicit
representation of closures as ATerms in the Nix store.  Instead, the
  file system pointer graph is now stored in the Nix database.  This
  has many advantages:

  - It greatly simplifies the implementation (we can drop the notion
    of `successors', and so on).

  - It makes registering roots for the garbage collector much easier.
    Instead of specifying the closure expression as a root, you can
    simply specify the store path that must be retained as a root.
    This could not be done previously, since there was no way to find
    the closure store expression containing a given store path.
    
  - Better traceability: it is now possible to query what paths are
    referenced by a path, and what paths refer to a path.
2005-01-19 11:16:11 +00:00
Eelco Dolstra
e9762e2d10 * Support arities > 6. 2005-01-19 11:04:24 +00:00
Eelco Dolstra
6d493751c3 * Get --readonly-mode to work again. 2005-01-18 11:15:50 +00:00
Eelco Dolstra
32aac8748a * Actually check that the result of fixed-output derivations matches
the specified hash.
2005-01-17 19:01:48 +00:00
Eelco Dolstra
f3dc231250 * Removed the `id' attribute hack.
* Formalise the notion of fixed-output derivations, i.e., derivations
  for which a cryptographic hash of the output is known in advance.
  Changes to such derivations should not propagate upwards through the
  dependency graph.  Previously this was done by specifying the hash
  component of the output path through the `id' attribute, but this is
  insecure since you can lie about it (i.e., you can specify any hash
  and then produce a completely different output).  Now the
  responsibility for checking the output is moved from the builder to
  Nix itself.

  A fixed-output derivation can be created by specifying the
  `outputHash' and `outputHashAlgo' attributes, the latter taking
  values `md5', `sha1', and `sha256', and the former specifying the
  actual hash in hexadecimal or in base-32 (auto-detected by looking
  at the length of the attribute value).  MD5 is included for
  compatibility but should be considered deprecated.

* Removed the `drvPath' pseudo-attribute in derivation results.  It's
  no longer necessary.

* Cleaned up the support for multiple output paths in derivation store
  expressions.  Each output now has a unique identifier (e.g., `out',
  `devel', `docs').  Previously there was no way to tell output paths
  apart at the store expression level.

* `nix-hash' now has a flag `--base32' to specify that the hash should
  be printed in base-32 notation.

* `fetchurl' accepts parameters `sha256' and `sha1' in addition to
  `md5'.

* `nix-prefetch-url' now prints out a SHA-1 hash in base-32.  (TODO: a
  flag to specify the hash.)
2005-01-17 16:55:19 +00:00
Eelco Dolstra
d58a11e019 * Shorten SHA-256 hashes used in store path name generation to 160
bits, then encode them in a radix-32 representation (using digits
  and letters except e, o, u, and t).  This produces store paths like
  /nix/store/4i0zb0z7f88mwghjirkz702a71dcfivn-aterm-2.3.1.  The nice
  thing about this is that the hash part of the file name is still 32
  characters, as before with MD5.

  (Of course, shortening SHA-256 to 160 bits makes it no better than
  SHA-160 in theory, but hopefully it's a bit more resistant to
  attacks; it's certainly a lot slower.)
2005-01-14 16:04:03 +00:00
Eelco Dolstra
9530cc3170 * Start move towards SHA-256 hashes instead of MD5.
* Start cleaning up unique store path generation (they weren't always
  unique; in particular the suffix ("-aterm-2.2", "-builder.sh") was
  not part of the hash, therefore changes to the suffix would cause
  multiple store objects with the same hash).
2005-01-14 13:51:38 +00:00
Eelco Dolstra
63791eb05b * Add SHA-256.
* Tests for the various hashes.
2005-01-14 12:03:04 +00:00
Eelco Dolstra
37b51a9aa6 * Removed some dead code. 2005-01-14 10:16:33 +00:00
Eelco Dolstra
7e8961f720 * Added SHA-1 support. nix-hash' now has an option --type sha1' to
select SHA-1 hashing.
2005-01-13 17:39:26 +00:00
Eelco Dolstra
73992371a3 * Refactoring to support SHA-1. 2005-01-13 15:44:44 +00:00
Eelco Dolstra
a03397be4c * Cygwin compatibility. 2005-01-04 17:38:26 +00:00
Eelco Dolstra
4f07ebc67e * Integrated bsdiff/bspatch 4.2 (from
http://www.daemonology.net/bsdiff/bsdiff-4.2.tar.gz) into the source
  tree.  The license is a bit peculiar, but it does allow verbatim
  copying, which is what we do here (i.e., so don't make any changes
  to the sources).
2004-12-29 22:08:48 +00:00
Eelco Dolstra
8b9697e575 * An operation `nix-store --clear-substitutes' to remove all
registered substitute mappings.
2004-12-20 14:16:55 +00:00
Eelco Dolstra
fa9259f5f5 * Simplify the substitute mechanism:
- Drop the store expression.  So now a substitute is just a
    command-line invocation (a program name + arguments).  If you
    register a substitute you are responsible for registering the
    expression that built it (if any) as a root of the garbage
    collector.
  - Drop the substitutes-rev DB table.
2004-12-20 13:43:32 +00:00
Eelco Dolstra
13f77276d1 * utime() follows symlinks, so don't change the mtime if the file is a
symlink.
2004-11-29 19:22:16 +00:00
Eelco Dolstra
f17553a212 * Remove debug statement. 2004-11-29 15:30:44 +00:00
Eelco Dolstra
4115d8d8ce * Canonicalise metadata of all files in store paths (set the mtime to
0, set the mode to either 444 or 555, set the group to the default).
2004-11-29 15:09:29 +00:00
Eelco Dolstra
54c7a870d5 * Document --delete-generations and other nix-env options. 2004-11-12 23:56:37 +00:00
Eelco Dolstra
c2b0d6b02f * Document --eval-only and --parse-only options in nix-instantiate. 2004-11-12 23:22:08 +00:00
Eelco Dolstra
92ee003dc9 * Fix broken format string. 2004-11-08 15:20:52 +00:00
Eelco Dolstra
cb7ccb528b * string2ATerm -> overloaded toATerm. 2004-11-03 18:12:03 +00:00
Eelco Dolstra
a69534fc21 * Drop ATmake / ATMatcher also in handling store expressions. 2004-10-29 11:22:49 +00:00
Eelco Dolstra
3277c9432a * Bug fix in parsing of /* ... */ comments; due to longest match
regexp there could be only one such comment per file.
2004-10-27 13:00:31 +00:00
Eelco Dolstra
f09618b63a * Turn on read-only mode in queries. This prevents redundant store I/O. 2004-10-27 10:24:44 +00:00
Eelco Dolstra
c7bea941b0 * Oops, I did it again. 2004-10-27 10:05:51 +00:00
Eelco Dolstra
210ab0296d * Add file to `make dist'. 2004-10-27 00:02:31 +00:00
Eelco Dolstra
c52dda95a6 * Bug: check that term is an application. 2004-10-26 23:30:18 +00:00
Eelco Dolstra
5fe9222b36 * Don't use ATmake / ATmatch anymore, nor the ATMatcher class.
Instead we generate data bindings (build and match functions) for
  the constructors specified in `constructors.def'.  In particular
  this removes the conversions between AFuns and strings, and Nix
  expression evaluation now seems 3 to 4 times faster.
2004-10-26 22:54:26 +00:00
Eelco Dolstra
eb8284ddaa * Evaluate argument to `import'. 2004-10-26 17:10:09 +00:00
Eelco Dolstra
033d7c6593 * Doh! 2004-10-26 17:04:55 +00:00
Eelco Dolstra
9fa07b376d * String/path concatenation operator (`+'). 2004-10-26 17:01:35 +00:00
Eelco Dolstra
ee401afad8 * Mode --parse-only' to parse the input (on stdin, -'), and print
out the AST as an ATerm.
* Mode `--eval-only' to parse and evaluate the input, and print the
  resulting normal form as an ATerm.

Neither of these modes require store/DB write permission.
2004-10-26 16:59:36 +00:00
Eelco Dolstra
37d7abd694 * New language feature: with expressions.
The expression `with E1; E2' evaluates to E2 with all bindings in
  the attribute set E1 substituted.  E.g.,

    with {x = 123;}; x

  evaluates to 123.  That is, the attribute set E1 is in scope in E2.

  This is particularly useful when importing files containing lots
  definitions.  E.g., instead of

    let {
      inherit (import ./foo.nix) a b c d e f;

      body = ... a ... f ...;
    }

  we can now say

    with import ./foo.nix;

    ... a ... f ...

  I.e., we don't have to say what variables should be brought into scope.
2004-10-25 16:54:56 +00:00
Eelco Dolstra
f4d44a0026 * Allow certain operations to succeed even if we don't have write
permission to the Nix store or database.  E.g., `nix-env -qa' will
  work, but `nix-env -qas' won't (the latter needs DB access).  The
  option `--readonly-mode' forces this mode; otherwise, it's only
  activated when the database cannot be opened.
2004-10-25 14:38:23 +00:00
Eelco Dolstra
3ade3e7721 * Revert r1594 - it didn't solve the problem. Instead add
svn-revision to distributions, which should fix it.
2004-10-25 13:51:34 +00:00
Eelco Dolstra
2248becfd3 * Make sure that the prerelease version is included in `--version'. 2004-10-25 12:15:50 +00:00
Eelco Dolstra
d830b2c1df * In `nix-env -q', sort derivations by name *without* case
sensitivity.
2004-10-14 15:09:55 +00:00
Eelco Dolstra
1317242780 * Make store objects created by substitutes read-only. 2004-09-22 12:15:04 +00:00
Eelco Dolstra
b357284a32 * Fallback didn't work for subderivations of an unnormalised the main
derivation, since NormalisationGoal would first run a
  NormalisationGoal on the subderivation (a no-op, since in a
  situation where we need fallback the successor is known), and then
  runs a RealisationGoal on the normal form, which then cannot do a
  fallback because it doesn't know the derivation expression for which
  it is a normal form.

  Tossed out the 2-phase normalisation/realisation in
  NormalisationGoal and SubstitutionGoal since it's no longer needed -
  a RealisationGoal will run a NormalisationGoal if necessary.
2004-09-12 19:08:57 +00:00
Eelco Dolstra
dcc433de47 * Operation `--delete-generations' to delete generations of a
profile.  Arguments are either generation number, or `old' to delete
  all non-current generations.  Typical use:

  $ nix-env --delete-generations old
  $ nix-collect-garbage

* istringstream -> string2Int.
2004-09-10 13:32:08 +00:00
Eelco Dolstra
c16be6ac92 * Remove write permission from store objects after they have been
added to the store.  Bug reported by Martin.
2004-09-09 21:19:20 +00:00
Eelco Dolstra
47f87072ad * A very dirty hack to make setuid installations a bit nicer to use.
Previously there was the problem that all files read by nix-env
  etc. should be reachable and readable by the Nix user.  So for
  instance building a Nix expression in your home directory meant that
  the home directory should have at least g+x or o+x permission so
  that the Nix user could reach the Nix expression.  Now we just
  switch back to the original user just prior to reading sources and
  the like.  The places where this happens are somewhat arbitrary,
  however.  Any scope that has a live SwitchToOriginalUser object in
  it is executed as the original user.

* Back out r1385.  setreuid() sets the saved uid to the new
  real/effective uid, which prevents us from switching back to the
  original uid.  setresuid() doesn't have this problem (although the
  manpage has a bug: specifying -1 for the saved uid doesn't leave it
  unchanged; an explicit value must be specified).
2004-09-09 21:12:53 +00:00
Eelco Dolstra
5396304c73 * Use setre[ug]id() instead of setres[ug]id(), since the former is
more common than the latter (which exists only on Linux and
  FreeBSD).  We don't really care about dropping the saved IDs since
  there apparently is no way to quiry them in any case, so it can't
  influence the build (unlike the effective IDs which are checked by
  Perl for instance).
2004-09-09 15:55:31 +00:00
Eelco Dolstra
e043fc7d0b * Set the umask to known value (0022). This is important in a
setuid installation, since the calling user may have a more fascist
  umask (say, 0077), which would cause the store objects built by Nix
  to be unreadable to anyone other than the Nix user.
2004-09-09 14:16:02 +00:00
Eelco Dolstra
5c443b6550 * Main the `substitutes-rev' table again, but now in a way that
doesn't take \Theta(n^2) space/time complexity.
2004-08-31 16:13:10 +00:00
Eelco Dolstra
c25f2883b1 * Quadruple the Berkeley DB locking limits to get rid of out of memory
errors while running `nix-store --verify'.
2004-08-31 10:50:08 +00:00
Eelco Dolstra
fe122c5a15 * Removed nrWaitees field. It was redundant with waitees.size() and
could get out of sync if multiple input derivations mapped to the
  same closure expression (since waitees is a set).
2004-08-30 11:51:36 +00:00
Eelco Dolstra
eb233e728f * `--min-age' flag in nix-store and nix-collect-garbage to only delete
unreachable paths that haven't been used for N hours.  For instance,
  `nix-collect-garbage --min-age 168' only deletes paths that haven't
  been accessed in the last week.

  This is useful for instance in the build farm where many derivations
  can be shared between consecutive builds, and we wouldn't want a
  garbage collect to throw them all away.  We could of course register
  them as roots, but then we'd to unregister them at some point, which
  would be a pain to manage.  The `--min-age' flag gives us a sort of
  MRU caching scheme.

  BUG: this really shouldn't be in gc.cc since that violates
  mechanism/policy separation.
2004-08-25 16:54:08 +00:00
Eelco Dolstra
fdec72c6cc * `nix-collect-garbage' now actually performs a garbage collection, it
doesn't just print the set of paths that should be deleted.  So
  there is no more need to pipe the result into `nix-store --delete'
  (which doesn't even exist anymore).
2004-08-25 15:39:13 +00:00
Eelco Dolstra
818047881e * Put the garbage collector in nix-store: operation `--gc',
suboperations `--print-live', `--print-dead', and `--delete'.  The
  roots are not determined by nix-store; they are read from standard
  input.  This is to make it easy to customise what the roots are.

  The collector now no longer fails when store expressions are missing
  (which legally happens when using substitutes).  It never tries to
  fetch paths through substitutes.

  TODO: acquire a global lock on the store while garbage collecting.
  
* Removed `nix-store --delete'.
2004-08-25 11:43:49 +00:00
Eelco Dolstra
9994c1dd9f * Validate derivation names. In particular don't allow spaces.
* Drop support for the outPath attribute in derivations.
2004-08-24 11:46:05 +00:00
Eelco Dolstra
8f58733ef1 * The gid should also match. 2004-08-20 15:47:58 +00:00
Eelco Dolstra
1c90fabccc * Unbreak programs that are not setuid (such as nix-hash). 2004-08-20 15:31:46 +00:00
Eelco Dolstra
e77fbe0fa2 * On systems that have the setresuid() and setresgid() system calls to
set the real uid and gid to the effective uid and gid, the Nix
  binaries can be installed as owned by the Nix user and group instead
  of root, so no root involvement of any kind is necessary.

  Linux and FreeBSD have these functions.
2004-08-20 15:22:33 +00:00
Eelco Dolstra
2d35116c13 * Setuid support for sharing a Nix installation between multiple
users.

  If the configure flag `--enable-setuid' is used, the Nix programs
  nix-env, nix-store, etc. are installed with the setuid bit turned on
  so that they are executed as the user and group specified by
  `--with-nix-user=USER' and `--with-nix-group=GROUP', respectively
  (with defaults `nix' and `nix').

  The setuid programs drop all special privileges if they are executed
  by a user who is not a member of the Nix group.

  The setuid feature is a quick hack to enable sharing of a Nix
  installation between users who trust each other.  It is not
  generally secure, since any user in the Nix group can modify (by
  building an appropriate derivation) any object in the store, and for
  instance inject trojans into binaries used by other users.

  The setuid programs are owned by root, not the Nix user.  This is
  because on Unix normal users cannot change the real uid, only the
  effective uid.  Many programs don't work properly when the real uid
  differs from the effective uid.  For instance, Perl will turn on
  taint mode.  However, the setuid programs drop all root privileges
  immediately, changing all uids and gids to the Nix user and group.
2004-08-20 14:49:05 +00:00
Eelco Dolstra
1eddee59f2 * The default verbosity level of all Nix commands is now lvlInfo.
* Builder output is written to standard error by default.
  * The option `-B' is gone.
  * The option `-Q' suppresses builder output.

The result of this is that most Nix invocations shouldn't need any
flags w.r.t. logging.
2004-08-18 12:19:06 +00:00
Eelco Dolstra
62fe5c4a22 * The predecessor of a successor need not be present. This in
particular happens on distributed builds or when using push/pull.
2004-08-11 19:03:13 +00:00
Eelco Dolstra
ae1a1efa41 * Clean up the temporary directory for hook communication (and don't
print out incorrect "build failed" messages).
2004-08-05 14:53:27 +00:00
Eelco Dolstra
d8989b1fb4 * Every real language has a `map' function. 2004-08-04 11:27:53 +00:00
Eelco Dolstra
bbfdd64741 * Allow primops with more that 1 arguments. 2004-08-04 10:59:20 +00:00
Eelco Dolstra
e3a50f7e25 * Creating a file nix-support/no-scan in the output path of a
derivation disables scanning for dependencies.  Use at your own
  risk.  This is a quick hack to speed up UML image generation (image
  are very big, say 1 GB).

  It would be better if the scanner were faster, and didn't read the
  whole file into memory.
2004-08-04 09:25:21 +00:00
Eelco Dolstra
c1a18f543e * Fixed format string error. 2004-07-06 11:21:34 +00:00
Eelco Dolstra
056cd1d3b7 * Don't go into a (sometimes infinite) loop calling the build hook. 2004-07-01 16:24:35 +00:00
Eelco Dolstra
638ce339a5 * Nix-instantiate now accepts sets of derivations (just like nix-env). 2004-07-01 14:25:26 +00:00
Eelco Dolstra
292d6468ec * Nix-env operations now by default filter out any derivations for
system types other than the current system.  I.e., `nix-env -i'
  won't install derivations for other system types, and `nix-env -q'
  won't show them.  The flag `--system-filter SYSTEM' can be used to
  override the system type used for filtering (but not for
  building!).  The value `*' can be used not to filter anything.
2004-07-01 13:56:56 +00:00
Eelco Dolstra
8f6254e823 * Align the columns in the output of `nix-env -q'. 2004-07-01 13:35:10 +00:00
Eelco Dolstra
593bc23d8b * Allow the system attribute of derivations to be queried in
`nix-env -q'.
* Queries can now be combined, e.g., `nix-env -q --status --system'.
2004-07-01 13:13:37 +00:00
Eelco Dolstra
b584253af4 * Include some missing headers. 2004-07-01 11:11:16 +00:00
Eelco Dolstra
f5d5ffe536 * Write build logs to disk again. 2004-06-29 09:41:50 +00:00
Eelco Dolstra
151e61fa5a * By default, `nix-env -i' now deletes previously installed
derivations with names matching the derivations being installed.
  The option `--preserve-installed / -P' overrides this behaviour.
2004-06-28 14:40:26 +00:00
Eelco Dolstra
4d2946c516 * In a realisation goal, check the result of the corresponding
normalisation goal.
2004-06-28 13:51:24 +00:00
Eelco Dolstra
24286e15c9 * `nix-env -u' now allows a specific version to be specified when
upgrading.

  This fixes a bug reported by Martin:

    $ nix-env -i foo-1.0
    $ nix-env -u foo-1.0
    upgrading foo-1.0 to foo-1.1
2004-06-28 13:37:05 +00:00
Eelco Dolstra
91dc023665 * Added a switch `--fallback'. From the manual:
Whenever Nix attempts to realise a derivation for which a closure is
  already known, but this closure cannot be realised, fall back on
  normalising the derivation.

  The most common scenario in which this is useful is when we have
  registered substitutes in order to perform binary distribution from,
  say, a network repository.  If the repository is down, the
  realisation of the derivation will fail.  When this option is
  specified, Nix will build the derivation instead.  Thus, binary
  installation falls back on a source installation.  This option is
  not the default since it is generally not desirable for a transient
  failure in obtaining the substitutes to lead to a full build from
  source (with the related consumption of resources).
2004-06-28 10:42:57 +00:00
Eelco Dolstra
b113edeab7 * A flag `--keep-going / -k' to keep building goals if one fails, as
much as possible.  (This is similar to GNU Make's `-k' flag.)

* Refactoring to implement this: previously we just bombed out when
  a build failed, but now we have to clean up.  In particular this
  means that goals must be freed quickly --- they shouldn't hang
  around until the worker exits.  So the worker now maintains weak
  pointers in order not to prevent garbage collection.

* Documented the `-k' and `-j' flags.
2004-06-25 15:36:09 +00:00
Eelco Dolstra
e4883211f9 * Don't throw an exception when a build fails. Just terminate the
goal and allow the problem to be handled elsewhere (e.g., at
  top-level).
2004-06-25 10:21:44 +00:00
Eelco Dolstra
795d9f8b08 * Obsolete. 2004-06-24 14:36:50 +00:00
Eelco Dolstra
ec32627621 * Multiple and/or failing substitutes now work. 2004-06-24 13:40:38 +00:00
Eelco Dolstra
66c7f34759 * Arghhhhhh 2004-06-22 17:07:32 +00:00
Eelco Dolstra
05a5362d63 * Some more diagnostics changes. 2004-06-22 17:04:10 +00:00
Eelco Dolstra
83ae1723da * Well, it's better than printf. 2004-06-22 15:01:01 +00:00
Eelco Dolstra
72bc9a522f * Started making Nix's diagnostic messages a bit more useful. 2004-06-22 14:48:59 +00:00
Eelco Dolstra
5e2cf44a4d * Put WEXITSTATUS stuff somewhere else. 2004-06-22 11:03:41 +00:00
Eelco Dolstra
84007a0958 * Reduce gratuitous cut & pasting. 2004-06-22 10:21:44 +00:00
Eelco Dolstra
c9fbd2dfd5 * Wrapper class around pids. 2004-06-22 09:51:44 +00:00
Eelco Dolstra
155d7c8dfa * Substitutes should occupy a build slot. 2004-06-22 09:00:31 +00:00
Eelco Dolstra
c4cb6ea2bc * Refactoring. 2004-06-22 08:50:25 +00:00
Eelco Dolstra
2db9748221 * Remove debug output. 2004-06-21 10:01:17 +00:00
Eelco Dolstra
3f3a3ae87b * Acquire a lock on the output path when running a substitute. Also
delete obstructing invalid paths.
2004-06-21 09:35:50 +00:00
Eelco Dolstra
72c857f0eb * Ugh, nasty Heisenbug due to an uninitialiased variable. The bug
only caused a crash if the program was *not* invoked with a high
  verbosity level.
2004-06-21 08:51:55 +00:00
Eelco Dolstra
be1a917beb * Remove obstructing invalid store paths add[Text]ToStore(). 2004-06-21 07:46:02 +00:00
Eelco Dolstra
daf0a923c7 * Wrap calls to registerSubstitute() in a single transaction to
improve throughput.
* Don't build the `substitute-rev' table for now, since it caused
  Theta(N^2) time and log file consumption when adding N substitutes.
  Maybe we can do without it.
2004-06-21 07:38:17 +00:00
Eelco Dolstra
15c60ca1b6 * Disable calls to fsync() since Berkeley DB's DB_TXN_WRITE_NOSYNC
flag doesn't seem to work as advertised.
2004-06-21 07:36:01 +00:00
Eelco Dolstra
112ee89501 * Re-enable support for substitutes in the normaliser.
* A better substitute mechanism.

  Instead of generating a store expression for each store path for
  which we have a substitute, we can have a single store expression
  that builds a generic program that is invoked to build the desired
  store path, which is passed as an argument.

  This means that operations like `nix-pull' only produce O(1) files
  instead of O(N) files in the store when registering N substitutes.
  (It consumes O(N) database storage, of course, but that's not a
  performance problem).

* Added a test for the substitute mechanism.
  
* `nix-store --substitute' reads the substitutes from standard input,
  instead of from the command line.  This prevents us from running
  into the kernel's limit on command line length.
2004-06-20 19:17:54 +00:00
Eelco Dolstra
85ae781765 * Refactoring. 2004-06-20 13:37:51 +00:00
Eelco Dolstra
23bb902d1f * Re-enable build hooks. 2004-06-19 21:45:04 +00:00
Eelco Dolstra
41ec982f31 * Big refactoring. Move to a much more explicitly state machine based
approach.  This makes it much easier to add extra complexity in the
  normaliser / realiser (e.g., build hooks, substitutes).
2004-06-18 18:09:32 +00:00
Eelco Dolstra
3454c685ee * This is also useful. 2004-06-18 16:52:31 +00:00
Eelco Dolstra
6ba26f27c3 * Shared (garbage collecting) pointers. Copied from Boost. 2004-06-18 09:20:51 +00:00
Eelco Dolstra
0b70231b9d * Refactoring. 2004-06-15 13:49:42 +00:00
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
Eelco Dolstra
d6b6b2d3a8 * Delete obstructed paths prior to building. 2003-08-05 09:47:20 +00:00
Eelco Dolstra
d2e963f7a3 * Path locking in addToStore() and expandPath(). 2003-08-04 07:09:36 +00:00
Eelco Dolstra
c95b4ad290 * In normaliseFState(), wrap registration of the output paths and the
normal form in a single transaction to ensure that if we crash,
  either everything is registered or nothing is.  This is for
  recoverability: unregistered paths in the store can be deleted
  arbitrarily, while registered paths can only be deleted by running
  the garbage collector.
2003-08-01 15:41:47 +00:00
Eelco Dolstra
d99d04e644 * Defensive programming against POSIX locking idiocy.
* Simplified realiseSlice().
2003-08-01 15:06:23 +00:00
Eelco Dolstra
545145cd58 * normaliseFState() now locks all output paths prior to building, thus
ensuring that simultaneous invocations of Nix don't clobber
  each other's  builds.

* Fixed a bug in `make install'.
2003-08-01 14:11:19 +00:00
Eelco Dolstra
9df93f30bd * Don't use substitutes in addToStore(). 2003-08-01 09:01:51 +00:00
Eelco Dolstra
06434072e7 * Put the database verifier in a transaction. 2003-07-31 19:49:11 +00:00
Eelco Dolstra
06d3d7355d * Enclose most operations that update the database in transactions.
* Open all database tables (Db objects) at initialisation time, not
  every time they are used.  This is necessary because tables have to
  outlive all transactions that refer to them.
2003-07-31 16:05:35 +00:00
Eelco Dolstra
177a7782ae * Use a more reasonable log file size (256 KB instead of 10 MB).
* Checkpoint on exit.
2003-07-31 14:28:49 +00:00
Eelco Dolstra
4a013962bd * Started using Berkeley DB environments. This is necessary for
transaction support (but we don't actually use transactions yet).
2003-07-31 13:47:13 +00:00
Eelco Dolstra
758bd4673a * Set execute bit. 2003-07-31 13:13:27 +00:00
Eelco Dolstra
83075304e5 * Don't make the builder executable. 2003-07-30 09:49:47 +00:00
Eelco Dolstra
8846465934 * Get garbage collection and cache population to work *properly*.
Renamed `fstateRefs' to `fstateRequisites'.  The semantics of this
  function is that it returns a list of all paths necessary to realise
  a given expression.  For a derive expression, this is the union of
  requisites of the inputs; for a slice expression, it is the path of
  each element in the slice.  Also included are the paths of the
  expressions themselves.  Optionally, one can also include the
  requisites of successor expressions (to recycle intermediate
  results).

* `nix-switch' now distinguishes between an expression and its normal
  form.  Usually, only the normal form is registered as a root of the
  garbage collector.  With the `--source-root' flag, it will also
  register the original expression as a root.

* `nix-collect-garbage' now has a flag `--keep-successors' which
  causes successors not to be included in the list of garbage paths.

* `nix-collect-garbage' now has a flag `--invert' which will print all
  paths that should *not* be garbage collected.
2003-07-29 14:28:17 +00:00
Eelco Dolstra
dc14a3de46 * Nicer dot graphs. 2003-07-29 10:53:27 +00:00
Eelco Dolstra
79ba0431db * `fstateRefs' now works on derive expressions as well. TODO: make
this more efficient.
* A flag `-n' in 'nix --query' to normalise the argument.  Default is
  not to normalise.
2003-07-29 10:43:12 +00:00
Eelco Dolstra
5acb45446e * Let `nix --install' print out the id of the normal form.
* Some minor refactoring.
2003-07-29 09:45:03 +00:00
Eelco Dolstra
949c4fa1a8 * `nix --help'.
* `nix --query --graph' to print a dot dependency graph of derive
  expressions.
2003-07-28 12:19:23 +00:00
Eelco Dolstra
f21b341957 * Fix message. 2003-07-24 15:03:36 +00:00
Eelco Dolstra
0a0c1fcb4d * The `-v' flag no longer takes an argument; it should be repeated
instead (e.g., `-vvvv' for lots of output).  Default is to only
  print error messages.
2003-07-24 13:43:16 +00:00
Eelco Dolstra
3b521bb1bd * Do sync the database, since not doing so caused database changes not
to reach the disk at all.  Looks like a bug.
2003-07-24 13:35:17 +00:00
Eelco Dolstra
1a7468a57a * Debug levels. Use `--verbose / -v LEVEL' to display only messages
up to the given verbosity levels.  These currently are:

    lvlError = 0, 
    lvlNormal = 5,
    lvlDebug = 10,
    lvlDebugMore = 15

  although only lvlError and lvlDebug are actually used right now.
2003-07-24 08:53:43 +00:00
Eelco Dolstra
b75719b984 * Don't sync the database on close. This was killing performance.
(Of course, the real problem is that we open the database for
  *every* operation; we should only open it once.  And we should use
  transactions.)
2003-07-24 08:24:32 +00:00
Eelco Dolstra
39ce70025b * Incorporated Berkeley DB and ATerm into the source tree.
* `make dist'.
2003-07-23 15:53:34 +00:00
Eelco Dolstra
9202570f8c * libdb_cxx-4 -> libdb_cxx 2003-07-22 20:02:33 +00:00
Eelco Dolstra
e877c69d78 * Substitutes now should produce a path with the same id as they are
substituting for (obvious, really).

* For greater efficiency, nix-pull/unnar will place the output in a
  path that is probably the same as what is actually needed, thus
  preventing a path copy.

* Even if a output id is given in a Fix package expression, ensure
  that the resulting Nix derive expression has a different id.  This
  is because Nix expressions that are semantically equivalent (i.e.,
  build the same result) might be different w.r.t. efficiency or
  divergence.  It is absolutely vital for the substitute mechanism
  that such expressions are not used interchangeably.
2003-07-22 15:15:15 +00:00
Eelco Dolstra
df648c4967 * nix --query --expansion' (-qe') to get any path with content
corresponding to the given id.
2003-07-22 10:24:22 +00:00
Eelco Dolstra
d5ee6f8700 * In `--query --generators', print out paths, not ids.
(There should really be a switch for this).
2003-07-21 21:31:03 +00:00
Eelco Dolstra
2616e6a6f3 * Check for errors. 2003-07-21 20:58:34 +00:00
Eelco Dolstra
9f4ad99e92 * Canonicalise path. 2003-07-21 20:58:21 +00:00
Eelco Dolstra
249988a787 * Allow the output/expression id to be forced to a certain
value; this potentially dangerous feature enables better 
  sharing for those paths for which the content is known in 
  advance (e.g., because a content hash is given).
* Fast builds: if we can expand all output paths of a derive 
  expression, we don't have to build.
2003-07-21 20:07:12 +00:00
Eelco Dolstra
49231fbe41 * Changes to the command line syntax of Nix.
* A function to find all Nix expressions whose output ids are
  completely contained in some set.  Useful for uploading relevant Nix
  expressions to a shared cache.
2003-07-21 14:46:01 +00:00
Eelco Dolstra
401452e57a * Memoize the evaluation of Fix expressions to speed up computation. 2003-07-21 08:55:49 +00:00
Eelco Dolstra
7984cfc7c1 * Argh, another short-write problem. Added wrappers around
read()/write() to fix this once and for all.
2003-07-20 21:11:43 +00:00
Eelco Dolstra
667a6afb9d * Remove accidentally added file. 2003-07-20 19:30:53 +00:00
Eelco Dolstra
6f1a0f948d * Refactorings. 2003-07-20 19:29:38 +00:00
Eelco Dolstra
b3fc38bf6a * For debugging: `nix --verify' to check the consistency of the
database and store.
2003-07-17 12:27:55 +00:00
Eelco Dolstra
71cc3ceae5 * Preserve the executable bit. 2003-07-17 11:25:14 +00:00
Eelco Dolstra
54664b6fb7 * The write() system call can write less than the requested
number of bytes, e.g., in case of a signal like SIGSTOP.  
  This caused `nix --dump' to fail sometimes.

  Note that this bug went unnoticed because the call to `nix 
  --dump' is in a pipeline, and the shell ignores non-zero 
  exit codes from all but the last element in the pipeline.  
  Is there any way to check the result of the initial elements
  in the pipeline?  (In other words, is it at all possible to 
  write reliable shell scripts?)
2003-07-16 21:24:02 +00:00
Eelco Dolstra
6822fd7bf4 * Bug fix: slices are transitive, so if we detect that an
input path is referenced in an output paths, we also have to 
  add all ids referenced by that input path.
* Better debug assertions to catch these sorts of errors.
2003-07-16 20:33:29 +00:00
Eelco Dolstra
9d56ca219f * Substitute fixes. 2003-07-16 20:00:51 +00:00
Eelco Dolstra
b9ecadee6e * Fix the -qr query. 2003-07-16 11:05:59 +00:00
Eelco Dolstra
c11bbcfd26 * Fix self-referential outputs.
* Fix -qp query.
2003-07-16 08:30:26 +00:00
Eelco Dolstra
d41d085b77 * Get Fix and Nix to work again. 2003-07-15 22:28:27 +00:00
Eelco Dolstra
7b3f44e05b * The new normaliser now passes the unit tests. 2003-07-15 21:24:05 +00:00
Eelco Dolstra
f5b6fa5256 * Basic work on allowing derive expressions to build multiple paths.
This is not entirely trivial since this introduces the possibility
  of mutual recursion.
* Made normal forms self-contained.
* Use unique ids, not content hashes, for content referencing.
2003-07-15 16:28:54 +00:00
Eelco Dolstra
3509299aca * After building, scan for actual file system references as
opposed to declared references.  This prunes the reference
  graph, thus allowing better garbage collection and more
  efficient derivate distribution.
2003-07-14 10:23:11 +00:00
Eelco Dolstra
135b7d54db * Don't check for staleness by default. 2003-07-13 21:43:57 +00:00
Eelco Dolstra
e6363b05ae * Pass $(prefix) and other variables through -D..., not
through config.h, to prevent silly Autoconf problems.
2003-07-13 19:26:00 +00:00
Eelco Dolstra
9c620e4afa * Generate the scripts so that we can substitute the prefix
etc. correctly.
* Fixed nix-switch.
2003-07-13 18:58:03 +00:00
Eelco Dolstra
73b163c1a1 * Fix a bug that caused Fix not to be deterministic (due to addToStore
returning different paths if the hash of the path to be added was
  already available in the store under a different name).
2003-07-11 08:41:03 +00:00
Eelco Dolstra
c834a5c597 * Fix handling of pipes (read(2) may not return the required
number of bytes in one call).
2003-07-11 08:16:15 +00:00
Eelco Dolstra
e5fbf58041 * A command to register successor fstate expressions.
Unifying substitutes and successors isn't very feasible for now,
  since substitutes are only used when no path with a certain is
  known.  Therefore, a normal form of some expression stored as a
  substitute would not be used unless the expression itself was
  missing.
2003-07-10 18:48:11 +00:00
Eelco Dolstra
1d1c3691d2 * The policy-free derivate sharing now *almost* works. :-) For any
hash for which no local expansion is available, Nix can execute a
  `substitute' which should produce a path with such a hash.

  This is policy-free since Nix does not in any way specify how the
  substitute should work, i.e., it's an arbitrary (unnormalised)
  fstate expression.  For example, `nix-pull' registers substitutes
  that fetch Nix archives from the network (through `wget') and unpack
  them, but any other method is possible as well.  This is an
  improvement over the old Nix sharing scheme, which had a policy
  (fetching through `wget') built in.

  The sharing scheme doesn't work completely yet because successors
  from fstate rewriting have to be registered on the receiving side.
  Probably the whole successor stuff can be folded up into the
  substitute mechanism; this would be a nice simplification.
2003-07-10 15:11:48 +00:00
Eelco Dolstra
d072485d28 * Get `nix-push' working again. It now uses Nix/Fix to create Nix
archives (using the package in corepkgs/nar).
* queryPathByHash -> expandHash, and it takes an argument specifying
  the target path (which may be empty).
* Install the core Fix packages in $prefix/share/fix.  TODO: bootstrap
  Nix and install Nix as a Fix package.
2003-07-10 13:41:28 +00:00
Eelco Dolstra
5d4b90b689 * Actually go through the search directories when looking for files. 2003-07-10 09:21:40 +00:00
Eelco Dolstra
6011bd0da2 * Outline of the new scheme for derivate distribution. 2003-07-09 16:12:40 +00:00
Eelco Dolstra
2b95a9dc05 * When computing the set of paths referenced by an expression, also
include the paths of the subterms.
2003-07-09 15:02:03 +00:00
Eelco Dolstra
9a99dc736d * Canonicalise paths so that Fix produces identical Nix
expressions for identical inputs.
2003-07-08 20:26:22 +00:00
Eelco Dolstra
cab3f4977a * A path canonicaliser that doesn't depend on the existence of paths
(i.e., it doesn't use realpath(3), which is broken in any case).
  Therefore it doesn't resolve symlinks.
2003-07-08 19:58:41 +00:00
Eelco Dolstra
333f4963de * The output of a Derive() node is not a referenced path. 2003-07-08 15:33:06 +00:00
Eelco Dolstra
40274c1f4f * A command to query the paths referenced by an fstate expression.
* Use a temporary directory for build actions.
2003-07-08 13:22:08 +00:00
Eelco Dolstra
a279137327 * Get --dump' and --delete' to work again. 2003-07-08 10:00:46 +00:00
Eelco Dolstra
85a913a3e7 * Renamed id' -> name' to remove the implication of uniqueness. 2003-07-08 09:59:00 +00:00
Eelco Dolstra
0b38b43bab * deletePath() now removes the path from the hash2paths mapping. 2003-07-08 09:54:47 +00:00
Eelco Dolstra
ab644ad10b * BaseName() primitive for the generation of more sensible names
(especially in fetchurl.fix).
2003-07-08 09:53:46 +00:00
Eelco Dolstra
a5a90f501e * Get rid of the `netsources' database.
* Rename the `refs' database to `hash2paths'.
2003-07-08 08:35:06 +00:00
Eelco Dolstra
be96c2189c * --realise' -> --install'. 2003-07-07 09:29:40 +00:00
Eelco Dolstra
5895c160c4 * Make dbRefs a mapping from Hash to [Path]. 2003-07-07 09:25:26 +00:00
Eelco Dolstra
609a224848 * Fixed `make check' as well. 2003-07-07 07:44:57 +00:00
Eelco Dolstra
224c585aba * Refactoring on the file names. 2003-07-07 07:43:58 +00:00
Eelco Dolstra
7952a8053c * A utility `nix-hash' to compute Nix path hashes. 2003-07-06 15:11:02 +00:00
Eelco Dolstra
bfa5d77211 * Bug fix: properly check result of open(). 2003-07-06 15:08:39 +00:00
Eelco Dolstra
82e3d8fafe * Got Fix working again. 2003-07-06 14:20:47 +00:00
Eelco Dolstra
f826e432aa * Refactoring: move initialisation and argument parsing into a shared
file.
2003-07-04 15:42:03 +00:00
Eelco Dolstra
01b34fe584 * Cleanup. 2003-07-04 15:29:58 +00:00
Eelco Dolstra
207ff2caf0 * Caching of expression successors. 2003-07-04 12:18:06 +00:00
Eelco Dolstra
40b5936691 * Realisation of Derive(...) expressions. 2003-06-27 14:56:12 +00:00
Eelco Dolstra
3da9687854 * Realisation of File(...) expressions. 2003-06-27 13:55:12 +00:00
Eelco Dolstra
d4c3edfaba * Normalisation. 2003-06-27 09:55:31 +00:00
Eelco Dolstra
3ec5252582 * Improved syntax and semantics for Nix expressions. 2003-06-25 15:50:37 +00:00
Eelco Dolstra
2b07b0e7eb * Minor cleanups. 2003-06-25 14:58:56 +00:00
Eelco Dolstra
692b562342 * `nix --delete' command. 2003-06-23 14:40:49 +00:00
Eelco Dolstra
c0cbaef4be * `nix --restore' command. 2003-06-23 14:08:34 +00:00
Eelco Dolstra
5f5cab0ac7 * A function to restore from a Nix archive.
* addValue() can now import any dumpable FS object.
2003-06-23 13:27:59 +00:00
Eelco Dolstra
85effedca3 * Flags to indicate how values are specified on the command line
(--hash, --file, --name).
2003-06-20 14:11:31 +00:00
Eelco Dolstra
5079ccb455 * Move most of Nix into a library (libnix.a).
* Run `test' on `make check'.
2003-06-20 10:53:04 +00:00
Eelco Dolstra
1849aa2a72 * Refactoring: move dump function into archive.cc. 2003-06-20 10:40:25 +00:00
Eelco Dolstra
38e12df631 * `nix --dump' command. 2003-06-18 14:34:43 +00:00
Eelco Dolstra
aeaffec785 * Dump symlinks. 2003-06-18 14:34:03 +00:00
Eelco Dolstra
94cf1f86bb * Lambdas, applications, substitutions. 2003-06-18 12:36:12 +00:00
Eelco Dolstra
fab7b128b9 * Automake sucks. 2003-06-18 08:07:28 +00:00
Eelco Dolstra
34fcf5fa0c * Started integrating the new evaluation model into Nix.
* Cleaned up command-line syntax.
2003-06-17 21:12:58 +00:00
Eelco Dolstra
7a96da3627 * Test for expression dereferencing. 2003-06-17 15:47:25 +00:00
Eelco Dolstra
6656993f83 * Derefencing of hashed expressions. 2003-06-17 15:45:43 +00:00
Eelco Dolstra
a7ab242fb4 * Simplify the evaluator. 2003-06-17 13:37:44 +00:00
Eelco Dolstra
c739e20585 * Argument processing. 2003-06-16 21:01:18 +00:00
Eelco Dolstra
727beb798a * Canonicalization: when hashing directories, sort the directory
entries by name.
2003-06-16 16:16:09 +00:00
Eelco Dolstra
2f04e7102e * Path hashing. 2003-06-16 15:59:23 +00:00
Eelco Dolstra
a09e66da5a * Description of path hashing algorithm. 2003-06-16 14:19:32 +00:00
Eelco Dolstra
822794001c * Started implementing the new evaluation model.
* Lots of refactorings.
* Unit tests.
2003-06-16 13:33:38 +00:00
Eelco Dolstra
b9f09b3268 * AST for Nix expressions. 2003-06-16 07:03:40 +00:00
Eelco Dolstra
21fe717ce2 * Refactoring: hash class. 2003-06-15 13:41:32 +00:00
Eelco Dolstra
f66055fa1e * Set umask to 0022 on startup. 2003-05-30 20:53:36 +00:00
Eelco Dolstra
5908663f42 * Send log output to stderr. 2003-05-30 17:01:21 +00:00
Eelco Dolstra
d1f5fd7216 * Log the output of builders to $prefix/var/log/nix. 2003-05-30 15:21:52 +00:00
Eelco Dolstra
64582f54be * Open the database read-only when enumerating tables. 2003-05-30 15:18:30 +00:00
Eelco Dolstra
4d21cda0cd * Fix for big-endian platforms: check for endianness in MD5 computations.
This is done at runtime, which is inefficient, but I can't be bothered
  to write an Autoconf test right now.
2003-05-27 09:55:47 +00:00
Eelco Dolstra
9efad76595 * FreeBSD / ISO C++ compatibility fixes. 2003-05-26 15:09:10 +00:00
Eelco Dolstra
d8bdf5b06e * Removed some debug code that prevented packages from building. 2003-05-26 14:19:25 +00:00
Eelco Dolstra
8b930a0c94 * Some refactoring. 2003-05-26 13:45:00 +00:00
Eelco Dolstra
f8d91f20e6 * Nix can now fetch prebuilts (and other files) from the network, iff
a mapping from the hash to a url has been registered through `nix
  regurl'.

* Bug fix in nix: don't pollute stdout when running tar, it made
  nix-switch barf.

* Bug fix in nix-push-prebuilts: don't create a subdirectory on the
  target when rsync'ing.
2003-05-26 09:44:18 +00:00
Eelco Dolstra
7dd91d3779 * Prebuilt package sharing. We allow transparent binary deployment by
sharing package directories (i.e., the result of building a Nix
  descriptor).

  `nix-pull-prebuilts' obtains a list of all known prebuilts by
  consulting the paths and URLs specified in
  $prefix/etc/nix/prebuilts.conf.  The mappings ($pkghash,
  $prebuilthash) and ($prebuilthash, $location) are registered with
  Nix so that it can use the prebuilt with hash $prebuilthash when
  installing a package with hash $pkghash by downloading and unpacking
  $location.

  `nix-push-prebuilts' creates prebuilts for all packages for which no
  prebuilt is known to exist.  It can then optionally upload these
  to the network through rsync.

  `nix-[pull|push]-prebuilts' just provide a policy.  Nix provides the
  mechanism through the `nix [export|regprebuilt|regurl]' commands.
2003-05-25 22:42:19 +00:00
Eelco Dolstra
0ef4b6d0f8 * Cleaned up the semantics of Fix expressions.
* Conditionals and variables in Fix expressions.  This allows, e.g.,

    Descr(
    [ Bind("pkgId", "subversion-0.21.0")

    , Bind("httpsClient", Bool(True))
    , Bind("httpServer", Bool(True))

    , Bind("ssl", If(Var("httpsClient"), Fix("./openssl-0.9.7b.fix"), ""))

    , Bind("httpd", If(Var("httpServer"), Fix("./httpd-2.0.45.fix"), ""))
    ...
    ])

  which introduces domain feature variables httpsClient and httpServer
  (i.e., whether Subversion is built with https client and webdav
  server support); the values of the variables influences package
  dependencies and the build scripts.

  The next step is to allow that packages can express constraints on
  each other.  E.g., StrategoXT is dependent on an ATerm library with
  the "gcc" variant enabled.  In fact, this may cause several
  Nix instantiations to be created from a single Fix descriptor.  If
  possible, Fix should try to find the least set of instantiations
  that obeys the constraints.
2003-04-25 15:33:50 +00:00
Eelco Dolstra
fcc5ae151b * Remove build directory from a package directory after building it. 2003-04-25 15:01:15 +00:00
Eelco Dolstra
24b3d0759e * File removed. 2003-04-24 11:41:50 +00:00
Eelco Dolstra
9713e8577f * getpkg, delpkg, and so on now accept multiple arguments. 2003-04-24 11:41:24 +00:00
Eelco Dolstra
e59c3246b9 * Redirect stdout to stderr when executing the build script. 2003-04-23 07:21:57 +00:00
Eelco Dolstra
b762f4df7f * In `fix --instantiate', only print out the hashes of the Nix
descriptors generated out of Fix descriptors specified on the
  command line.  This allows us to say:

    nix-switch $(fix -i ./test/fixdescriptors/system.fix)
2003-04-09 12:37:49 +00:00
Eelco Dolstra
aa8fda4b54 * We no longer use nix-populate standalone, rather we use it as a
build action for `system' packages (like system.fix) that have
  dependencies on all packages we want to activate.

  So the command sequence to switch to a new activation configuration
  of the system would be:

    $ fix -i .../fixdescriptors/system.fix
    ...
    system.fix -> 89cf4713b37cc66989304abeb9ea189f

    $ nix-switch 89cf4713b37cc66989304abeb9ea189f

* A nix-profile.sh script that can be included in .bashrc.
2003-04-09 12:26:48 +00:00
Eelco Dolstra
f56b7312b2 * Descriptor importing in Fix. 2003-04-08 15:36:54 +00:00
Eelco Dolstra
cc6eafb3d0 * FreeBSD / gcc 2.95 compatibility fixes.
* A script to generate prebuilt registration scripts.
2003-04-08 14:05:15 +00:00
Eelco Dolstra
0d2b24cdd1 * `Fix' is a high-level descriptor instantiator for Nix. It replaces
nix-instantiate.
2003-04-08 12:00:51 +00:00
Eelco Dolstra
814b256da4 * Better installation: make directories, create database.
* Fixed the register script.
2003-04-06 22:19:26 +00:00
Eelco Dolstra
136c00e881 * Autoconf / Automake configuration and building. 2003-04-04 16:14:56 +00:00
Eelco Dolstra
ab723e341a * Minor refactoring: use iterators to process arguments. 2003-04-04 12:02:40 +00:00
Eelco Dolstra
c68dca5dac * Script to register pre-built packages. 2003-04-02 15:34:44 +00:00
Eelco Dolstra
5bc26fb73f * Importing and exporting of pre-built packages. 2003-04-02 15:34:05 +00:00
Eelco Dolstra
383f9bb0f1 * Use ATerms for Nix descriptors. 2003-04-01 14:00:47 +00:00
Eelco Dolstra
31f177ef0a * Check for collissions. 2003-03-28 16:27:23 +00:00
Eelco Dolstra
278ea4097e * Don't fork in `nix run'. 2003-03-28 10:33:34 +00:00
Eelco Dolstra
f915f77349 * Allow arguments to be passed to programs in `nix run'. 2003-03-28 09:53:22 +00:00
Eelco Dolstra
0f40a560ca * Added a script nix-activate which builds a list of "activated"
packages (i.e., the packages that should appear in the user's $PATH,
  and so on).  Based on this list, the script nix-populate creates a
  hierarchy of symlinks to the relevant files in those packages (e.g.,
  for pkg/bin and pkg/lib).  

  A nice property of nix-populate is that on each run it creates a
  *new* tree, rather than updating the old one.  It then atomically
  switches over to the new tree.  This allows atomic upgrades or
  rollbacks on the set of activated packages.
2003-03-25 16:36:25 +00:00
Eelco Dolstra
3f1a1457e9 * Integrate hash into instantiated descriptor file names.
* Use MD5::Digest.
2003-03-25 11:39:51 +00:00
Eelco Dolstra
73c53935d0 * For efficiency: md5 integrated into nix.
* Command `nix ensure' which is like `nix getpkg' except that if the
  has refers to a run action it will just ensure that the imports are
  there.
* Command `nix closure' to print out the closure of the set of
  descriptors under the import relation, starting at a set of roots.
  This can be used for garbage collection (e.g., given a list of
  `activated' packages, we can delete all packages not reachable from
  those).
* Command `nix graph' to print out a Dot graph of the dependency
  graph.
* `nix-addroot' adds a root for the (unimplemented) garbage collector.
2003-03-24 17:49:56 +00:00
Eelco Dolstra
2dc84e5569 * Descriptors now have a "system" field specifying the platform that
the build or run action should be perfomed on.  This ensures that
  descriptors have different hashes on different platforms.
2003-03-24 12:49:40 +00:00
Eelco Dolstra
9d2f128252 * Refactoring. 2003-03-24 11:50:20 +00:00
Eelco Dolstra
20d165c344 * A command to run programs in Nix packages, that is, to execute a run
action.  Run actions are described by uniquely hashed descriptors,
  just like build actions.  Therefore run actions can have
  dependencies, but these need not be the same as the build time
  dependencies (e.g., at runtime we can link against a different
  version of a dynamic library).  Example:

    nix run 31d6bf4c171282367065e0deecd7c579

  will run the Pan 0.13.91 newsreader with gtkspell support.
2003-03-23 23:24:09 +00:00
Eelco Dolstra
800d8e950f * Added a command to list installed packages. 2003-03-21 15:58:40 +00:00
Eelco Dolstra
2e59698b78 * Added a command to verify the consistency of the database. 2003-03-21 15:53:35 +00:00
Eelco Dolstra
e582ee67cd * Fetch sources from the network. 2003-03-21 14:10:06 +00:00
Eelco Dolstra
cadc3852e4 * nix-instantiate now instantiantes the closure of the set of
descriptor templates under the import relation.  I.e., we can now
  say:

    nix-instantiate outdir foo.nix

  which will create descriptors for foo.nix and all imported packages
  in outdir/.
2003-03-20 22:23:48 +00:00
Eelco Dolstra
f7a98e081d * Various updates. 2003-03-20 16:53:00 +00:00
Eelco Dolstra
b3594e9eaf * A script to instantiate package descriptors from templates. 2003-03-20 16:52:30 +00:00
Eelco Dolstra
8999f923ea * Improved Nix. Resources (package descriptors and other source
files) are now referenced using their cryptographic hashes.  

  This ensures that if two package descriptors have the same contents,
  then they describe the same package.  This property is not as
  trivial as it sounds: generally import relations cause this property
  not to hold w.r.t. temporality.  But since imports also use hashes
  to reference other packages, equality follows by induction.
2003-03-14 16:43:14 +00:00
Eelco Dolstra
18ebf518de * Converted to C++. 2003-03-13 16:28:32 +00:00
Eelco Dolstra
75d788b0f2 * Initial version of nix. 2003-03-13 14:24:49 +00:00