lix/tests
Eelco Dolstra 0dbd4638e0 * Two primops: builtins.intersectAttrs and builtins.functionArgs.
intersectAttrs returns the (right-biased) intersection between two
  attribute sets, e.g. every attribute from the second set that also
  exists in the first.  functionArgs returns the set of attributes
  expected by a function.

  The main goal of these is to allow the elimination of most of
  all-packages.nix.  Most package instantiations in all-packages.nix
  have this form:

    foo = import ./foo.nix {
      inherit a b c;
    };

  With intersectAttrs and functionArgs, this can be written as:

    foo = callPackage (import ./foo.nix) { };

  where

   callPackage = f: args:
     f ((builtins.intersectAttrs (builtins.functionArgs f) pkgs) // args);

  I.e., foo.nix is called with all attributes from "pkgs" that it
  actually needs (e.g., pkgs.a, pkgs.b and pkgs.c).  (callPackage can
  do any other generic package-level stuff we might want, such as
  applying makeOverridable.)  Of course, the automatically supplied
  arguments can be overriden if needed, e.g.

    foo = callPackage (import ./foo.nix) {
      c = c_version_2;
    };

  but for the vast majority of packages, this won't be needed.

  The advantages are to reduce the amount of typing needed to add a
  dependency (from three sites to two), and to reduce the number of
  trivial commits to all-packages.nix.  For the former, there have
  been two previous attempts:

    - Use "args: with args;" in the package's function definition.
      This however obscures the actual expected arguments of a
      function, which is very bad.

    - Use "{ arg1, arg2, ... }:" in the package's function definition
      (i.e. use the ellipis "..." to allow arbitrary additional
      arguments), and then call the function with all of "pkgs" as an
      argument.  But this inhibits error detection if you call it with
      an misspelled (or obsolete) argument.
2009-09-15 13:01:46 +00:00
..
lang * Two primops: builtins.intersectAttrs and builtins.functionArgs. 2009-09-15 13:01:46 +00:00
add.sh * Unify the treatment of sources copied to the store, and recursive 2008-12-03 15:06:30 +00:00
build-hook.hook.sh * Simplify communication with the hook a bit (don't use file 2009-03-28 19:29:55 +00:00
build-hook.nix * Refactoring: renamed *.nix.in to *.nix. 2009-03-17 17:11:55 +00:00
build-hook.sh * Clean up some tests (use nix-build where appropriate). 2009-03-18 13:15:55 +00:00
check-refs.nix * Refactoring: renamed *.nix.in to *.nix. 2009-03-17 17:11:55 +00:00
check-refs.sh * Checks for allowedReferences and some other features. 2006-10-19 17:44:51 +00:00
common.sh.in * Use bash in the tests. 2009-03-25 16:11:04 +00:00
config.nix.in * Refactoring: renamed *.nix.in to *.nix. 2009-03-17 17:11:55 +00:00
dependencies.builder0.sh * Regression test for the `exportReferencesGraph' 2009-03-17 16:33:48 +00:00
dependencies.builder1.sh * Purify `make check'. 2006-07-21 13:21:43 +00:00
dependencies.builder2.sh * Purify `make check'. 2006-07-21 13:21:43 +00:00
dependencies.nix * Regression test for the `exportReferencesGraph' 2009-03-17 16:33:48 +00:00
dependencies.sh * Acquire the locks on the output paths before trying to run the build 2009-03-18 14:48:42 +00:00
export-graph.nix * Unify exportReferencesGraph and exportBuildReferencesGraph, and make 2009-03-18 17:36:42 +00:00
export-graph.sh * Improve the test. 2009-03-18 16:36:13 +00:00
export.sh * Clean up some tests (use nix-build where appropriate). 2009-03-18 13:15:55 +00:00
fallback.sh * Fix the tests. 2007-08-13 13:15:02 +00:00
filter-source.nix * Refactoring: renamed *.nix.in to *.nix. 2009-03-17 17:11:55 +00:00
filter-source.sh New primitives: 2007-01-29 14:23:09 +00:00
fixed.builder1.sh * Test the impureEnvVars feature. 2007-09-11 13:32:04 +00:00
fixed.builder2.sh * Test case to show that parallel builds of different fixed-output 2007-08-28 09:21:47 +00:00
fixed.nix * Refactoring: renamed *.nix.in to *.nix. 2009-03-17 17:11:55 +00:00
fixed.sh * Clean up some tests (use nix-build where appropriate). 2009-03-18 13:15:55 +00:00
gc-concurrent.builder.sh * Increase the sleep periods a bit to make the test less likely to 2008-08-14 09:26:30 +00:00
gc-concurrent.nix * Refactoring: renamed *.nix.in to *.nix. 2009-03-17 17:11:55 +00:00
gc-concurrent.sh * Argh, stupid timing sensitive tests... 2009-03-27 22:40:22 +00:00
gc-concurrent2.builder.sh * Increase the sleep periods a bit to make the test less likely to 2008-08-14 09:26:30 +00:00
gc-runtime.nix * Refactoring: renamed *.nix.in to *.nix. 2009-03-17 17:11:55 +00:00
gc-runtime.sh * Fix race condition in the test. 2006-09-01 12:02:39 +00:00
gc.sh * TDD! Woohoo! 2006-03-01 14:26:03 +00:00
hash-check.nix * Purify `make check'. 2006-07-21 13:21:43 +00:00
hash.sh * Mac OS X 10.5 compatibility: echo -n foo' suddenly prints -n foo' 2007-12-14 14:08:09 +00:00
init.sh 2008-12-03 16:15:38 +00:00
install-package.sh * `nix-install-package --url': install from a URL (NIX-12). 2006-09-21 18:54:08 +00:00
lang.sh * Option --argstr for passing string arguments easily. (NIX-75) 2007-01-14 12:32:44 +00:00
logging.sh * Clean up some tests (use nix-build where appropriate). 2009-03-18 13:15:55 +00:00
Makefile.am * Negative caching, i.e. caching of build failures. Disabled by 2009-03-25 21:05:42 +00:00
misc.sh * Simplification. 2006-03-01 12:51:18 +00:00
negative-caching.nix * Negative caching, i.e. caching of build failures. Disabled by 2009-03-25 21:05:42 +00:00
negative-caching.sh * Negative caching, i.e. caching of build failures. Disabled by 2009-03-25 21:05:42 +00:00
nix-build.sh * Clean up some tests (use nix-build where appropriate). 2009-03-18 13:15:55 +00:00
nix-pull.sh * nix-push / generate-patches: bzip the manifest. 2007-09-04 15:38:09 +00:00
nix-push.sh * nix-push / generate-patches: bzip the manifest. 2007-09-04 15:38:09 +00:00
parallel.builder.sh * Make this test a bit more robust. It's still timing dependent 2009-03-23 15:16:36 +00:00
parallel.nix * Make this test a bit more robust. It's still timing dependent 2009-03-23 15:16:36 +00:00
parallel.sh * Make the poll interval configurable. 2009-03-30 11:34:03 +00:00
referrers.sh * Fixed compatibility with old versions of "wc" that print whitespace 2008-06-10 10:08:15 +00:00
remote-store.sh * Be sure to clean up the daemon if the test fails. 2008-12-04 16:55:22 +00:00
simple.builder.sh * Fix the tests. 2007-08-13 13:15:02 +00:00
simple.nix * Refactoring: renamed *.nix.in to *.nix. 2009-03-17 17:11:55 +00:00
simple.sh 2008-12-03 16:15:38 +00:00
substituter.sh * Fix the tests. 2008-08-04 16:16:49 +00:00
substituter2.sh * Fix the tests. 2008-08-04 16:16:49 +00:00
substitutes.sh * Fix the tests. 2007-08-13 13:15:02 +00:00
substitutes2.sh * Do a substitution even if --max-jobs == 0. 2009-03-31 21:14:07 +00:00
user-envs.builder.sh * Purify `make check'. 2006-07-21 13:21:43 +00:00
user-envs.nix * Refactoring: renamed *.nix.in to *.nix. 2009-03-17 17:11:55 +00:00
user-envs.sh * Test instrumentation. 2008-06-15 15:10:03 +00:00
verify.sh * Simplification. 2006-03-01 12:51:18 +00:00