Commit graph

154 commits

Author SHA1 Message Date
Eelco Dolstra
6c9fdb17fb * Don't use $SHELL. 2007-02-21 14:00:46 +00:00
Eelco Dolstra
7349bd0176 New primitives:
* `sub' to subtract two numbers.
* `stringLength' to get the length of a string.
* `substring' to get a substring of a string.  These should be enough
  to allow most string operations to be expressed.
2007-01-29 14:23:09 +00:00
Eelco Dolstra
e4b0666f8e * builtins.filterSource: pass the type of the file ("regular",
"directory", "symlink") as the second argument to the filter
  predicate.
2007-01-15 08:54:51 +00:00
Eelco Dolstra
8659edc098 * Don't forget the .flags files. 2007-01-14 12:33:04 +00:00
Eelco Dolstra
e418976107 * Option --argstr for passing string arguments easily. (NIX-75) 2007-01-14 12:32:44 +00:00
Eelco Dolstra
f23dcdd603 * Canonicalise ASTs in `nix-instantiate --eval': remove position
info, sort attribute sets.
2007-01-13 16:17:07 +00:00
Eelco Dolstra
a3e6415ba8 * New primop builtins.filterSource, which can be used to filter files
from a source directory.  All files for which a predicate function
  returns true are copied to the store.  Typical example is to leave
  out the .svn directory:

    stdenv.mkDerivation {
      ...
      src = builtins.filterSource
        (path: baseNameOf (toString path) != ".svn")
        ./source-dir;
      # as opposed to
      #   src = ./source-dir;
    }

  This is important because the .svn directory influences the hash in
  a rather unpredictable and variable way.
2006-12-12 23:05:01 +00:00
Eelco Dolstra
1a7e88bbd9 * New built-in function `builtins.attrNames' that returns the
names of the attributes in an attribute set.
2006-12-12 16:14:31 +00:00
Eelco Dolstra
626f8ee42f * Clear NIX_REMOTE in the tests. 2006-12-02 14:33:39 +00:00
Eelco Dolstra
7a4497d98c * Checks for allowedReferences and some other features.
* Use nix-build in a test.
2006-10-19 17:44:51 +00:00
Eelco Dolstra
dfc042a0c1 * Another test. 2006-10-17 11:16:02 +00:00
Eelco Dolstra
9e30694f98 * Fix the tests wrt the AST changes, i.e., Str(s) -> Str(s, []), and
the semantic changes.
2006-10-17 11:08:59 +00:00
Eelco Dolstra
7d4567f2cc * Removed URIs from the evaluator (NIX-66). They are now just another
kind of notation for strings.
2006-10-11 21:59:33 +00:00
Eelco Dolstra
d20c3011a0 * toFile: added an additional argument to specify the store path
suffix, e.g., `builtins.toFile "builder.sh" "..."'.
* toFile: handle references to other files correctly.
2006-10-03 14:55:54 +00:00
Eelco Dolstra
ac19b333b3 * Finally, a real "let" syntax: `let x = ...; ... z = ...; in ...'. 2006-10-02 15:52:44 +00:00
Eelco Dolstra
0e705391db * Primop `toPath' to convert a string to a path.
* Primop `pathExists' to check for path existence.
2006-09-24 18:23:32 +00:00
Eelco Dolstra
e47e0c2dbe * Builtin function `getEnv' for getting environment variables. 2006-09-24 17:48:41 +00:00
Eelco Dolstra
df8873e14a * lessThan primitive for integer comparison. 2006-09-24 15:21:48 +00:00
Eelco Dolstra
2ab4bc44c7 * Builtin function `add' to add integers.
* Put common test functions in tests/lang/lib.nix.
2006-09-22 15:29:21 +00:00
Eelco Dolstra
d315210612 * Added a builtin function `isList' to test whether a value is a list.
With this primitive, a list-flattening function can be implemented
  (NIX-55, example is in tests/lang/eval-okay-flatten.nix).
2006-09-22 14:55:19 +00:00
Eelco Dolstra
c02a44183f * Builtin functions head' and tail' to return the head and tail of
list.  Useful for lots of things, such as implementing a fold
  function (see NIX-30, example is in tests/lang/eval-okay-list.nix).
2006-09-22 14:46:36 +00:00
Eelco Dolstra
8a1ab709a4 * New builtin functions builtins.{hasAttr, getAttr} to check for
attribute existence and to return an attribute from an attribute
  set, respectively.  Example: `hasAttr "foo" {foo = 1;}'.  They
  differ from the `?' and `.' operators in that the attribute name is
  an arbitrary expression.  (NIX-61)
2006-09-22 14:31:55 +00:00
Eelco Dolstra
0bd5eb71a0 * `nix-install-package --url': install from a URL (NIX-12).
* `nix-install-package --help' (NIX-9).
* `nix-install-package --non-interactive': don't prompt or pause.
* Tests for nix-install-package.
* Security fixes: filter the values obtained from the nixpkg.
2006-09-21 18:54:08 +00:00
Eelco Dolstra
7974aae81c * New primop: builtins.toFile, which writes a string into the store
and returns its path.  This can be used to (for instance) write
  builders inside a Nix expression, e.g.,

  stdenv.mkDerivation {
    builder = "
      source $stdenv/setup
      ...
    ";
    ...
  }
2006-09-01 12:07:31 +00:00
Eelco Dolstra
de90fdf908 * Allow "$" in strings as long as they are not followed by "{". (Too
bad flex doesn't have lexical restrictions, the current solution
  isn't quite right...)
2006-09-01 12:04:06 +00:00
Eelco Dolstra
c9586b6c3f * Fix race condition in the test. 2006-09-01 12:02:39 +00:00
Eelco Dolstra
f93f7b75be * Okay, that's a bit harder than expected. 2006-08-30 13:10:04 +00:00
Eelco Dolstra
dce1afdc67 * TDD: == should do a deep equality test, i.e., it should strictly
evaluate its arguments.
2006-08-30 12:25:27 +00:00
Eelco Dolstra
1f6616dabf * Backwards compatibility test for ~. 2006-08-29 15:29:19 +00:00
Eelco Dolstra
215ec2ddc6 * New primop __toXML (or builtins.toXML) to convert an expression to
an XML representation stored in a string.  This should be useful to
  pass structured information to builders.
2006-08-24 14:34:29 +00:00
Eelco Dolstra
38f18aa6d4 * New primop: abort "error message". 2006-08-23 15:46:00 +00:00
Eelco Dolstra
4a053bfdfd * A new primop `builtins', which returns an attribute set containing
all the primops.  This allows Nix expressions to test for new
  primops and take appropriate action if they're not available.  For
  instance, rather than calling a primop `foo' directly, they could
  say `if builtins ? foo then builtins.foo ... else ...'.
2006-08-23 14:39:11 +00:00
Eelco Dolstra
93d9797eda * Urgh (see NIX-56). 2006-08-22 09:34:38 +00:00
Eelco Dolstra
cc0505f033 * Distribute *.exp.xml. 2006-08-17 12:21:39 +00:00
Eelco Dolstra
4874fd2d9a * Test for `nix-instantiate --eval-only --xml'. 2006-08-17 11:28:29 +00:00
Eelco Dolstra
fe101fa785 * Meh. 2006-08-16 10:29:43 +00:00
Eelco Dolstra
bfe19b3c37 * A test for NIX-53. 2006-08-16 10:23:02 +00:00
Eelco Dolstra
f4c5531d92 * New language feature: domain checks, which check whether a function
argument has a valid value, i.e., is in a certain domain.  E.g.,

    { foo : [true false]
    , bar : ["a" "b" "c"]
    }: ...

  This previously could be done using assertions, but domain checks
  will allow the buildfarm to automatically extract the configuration
  space from functions.
2006-07-24 16:35:34 +00:00
Eelco Dolstra
88acffa20a * `touch' might not be in $PATH. 2006-07-24 16:19:08 +00:00
Eelco Dolstra
b545c669a0 * Tests for domain checks. 2006-07-24 15:50:29 +00:00
Eelco Dolstra
57751fdb55 * Refactoring to support domain checks. 2006-07-24 15:16:03 +00:00
Eelco Dolstra
9c3099d328 * Purify `make check'. 2006-07-21 13:21:43 +00:00
Eelco Dolstra
7adaa6d446 * Test for runtime root finding. 2006-07-21 12:46:54 +00:00
Eelco Dolstra
410760c5ab * Doh. 2006-07-20 12:58:51 +00:00
Eelco Dolstra
c15f544356 * Call find-runtime-roots.pl from the garbage collector to prevent
running applications etc. from being garbage collected.
2006-07-20 12:17:25 +00:00
Eelco Dolstra
88e54153dc * Add a precise test for hashDerivatioModulo. 2006-07-19 15:49:29 +00:00
Eelco Dolstra
2b4b0658fa * This expression has an undefined variable which isn't detected, so
evaluation fails:

    error: impossible: undefined variable `gcc'
2006-07-10 17:35:00 +00:00
Eelco Dolstra
d7f40357e3 * Skip this test on Cygwin, too slow (and doesn't test anything Cygwin-specific). 2006-06-16 13:27:36 +00:00
Eelco Dolstra
c7d9397fc9 * Handle $PATHs with spaces. 2006-05-29 21:53:58 +00:00
Eelco Dolstra
5cabd47394 * Allow function argument default values to refer to other arguments
of the function.  Implements NIX-45.
2006-05-08 12:52:47 +00:00