about summary refs log tree commit diff
path: root/tests/lang
AgeCommit message (Collapse)AuthorFilesLines
2013-08-26 Fix typos, especially those that end up in the Nix manualIvan Kozik1-1/+1
2013-08-02 Let the ordering operators also work on stringsEelco Dolstra2-1/+6
E.g. ‘"foo" < "bar"’ now works.
2013-08-02 Add comparison operators ‘<’, ‘<=’, ‘>’ and ‘>=’Eelco Dolstra2-1/+24
2013-08-02 Add integer ‘-’, ‘*’ and ‘/’ operatorsEelco Dolstra3-1/+11
2013-08-02 Add a unary integer negation operatorEelco Dolstra2-2/+7
This allows saying "-1" instead of "builtins.sub 0 1".
2013-08-02 Overload the ‘+’ operator to support integer additionEelco Dolstra2-4/+4
2013-07-31 Test the delayed with a bit moreEelco Dolstra2-4/+7
2013-07-31 Delay evaulation of `with` attrs until a variable lookup needs themShea Levy2-0/+27
Evaluation of attribute sets is strict in the attribute names, which means immediate evaluation of `with` attribute sets rules out some potentially interesting use cases (e.g. where the attribute names of one set depend in some way on another but we want to bring those names into scope for some values in the second set). The major example of this is overridable self-referential package sets (e.g. all-packages.nix). With immediate `with` evaluation, the only options for such sets are to either make them non-recursive and explicitly use the name of the overridden set in non-overridden one every time you want to reference another package, or make the set recursive and use the `__overrides` hack. As shown in the test case that comes with this commit, though, delayed `with` evaluation allows a nicer third alternative. Signed-off-by: Shea Levy <shea@shealevy.com>
2013-02-08 Rename "hash" to "hashString" and handle SHA-1Eelco Dolstra2-5/+6
2013-02-08 experimental/hashMarc Weber2-0/+7
adding primop function calculating hash of a string Signed-off-by: Marc Weber <marco-oweber@gmx.de>
2012-09-27 Allow dashes in identifiersEelco Dolstra1-2/+2
In Nixpkgs, the attribute in all-packages.nix corresponding to a package is usually equal to the package name. However, this doesn't work if the package contains a dash, which is fairly common. The convention is to replace the dash with an underscore (e.g. "dbus-lib" becomes "dbus_glib"), but that's annoying. So now dashes are valid in variable / attribute names, allowing you to write: dbus-glib = callPackage ../development/libraries/dbus-glib { }; and buildInputs = [ dbus-glib ]; Since we don't have a negation or subtraction operation in Nix, this is unambiguous.
2012-01-19 * Add a test case for comparing derivations.Eelco Dolstra2-0/+11
2012-01-03 * Refactoring: Get rid of a few subdirectories in corepkgs/, and someEelco Dolstra1-1/+1
other simplifications. * Use <nix/...> to locate the corepkgs. This allows them to be overriden through $NIX_PATH. * Use bash's pipefail option in the NAR builder so that we don't need to create a temporary file.
2011-12-21 * Add some accidentally committed files.Eelco Dolstra2-2/+0
2011-08-06 * Add the Nix corepkgs to the end of the search path. This makes itEelco Dolstra2-3/+3
possible for other Nix expressions to use corepkgs (mostly useful for the buildenv function).
2011-08-06 * Allow redirections in search path entries. E.g. if you have aEelco Dolstra3-3/+3
directory /home/eelco/src/stdenv-updates that you want to use as the directory for import such as with (import <nixpkgs> { }); then you can say $ nix-build -I nixpkgs=/home/eelco/src/stdenv-updates
2011-08-06 * Add a Nix expression search path feature. Paths between angleEelco Dolstra13-0/+15
brackets, e.g. import <nixpkgs/pkgs/lib> are resolved by looking them up relative to the elements listed in the search path. This allows us to get rid of hacks like import "${builtins.getEnv "NIXPKGS_ALL"}/pkgs/lib" The search path can be specified through the ‘-I’ command-line flag and through the colon-separated ‘NIX_PATH’ environment variable, e.g., $ nix-build -I /etc/nixos ... If a file is not found in the search path, an error message is lazily thrown.
2011-07-13 * Allow attribute names to be strings. Based on theEelco Dolstra2-0/+21
allow-arbitrary-strinsg-in-names patch by Marc Weber.
2011-07-13 * Allow a default value in attribute selection by writingEelco Dolstra2-0/+22
x.y.z or default (as originally proposed in https://mail.cs.uu.nl/pipermail/nix-dev/2009-September/002989.html). For instance, an expression like stdenv.lib.attrByPath ["features" "ckSched"] false args can now be written as args.features.ckSched or false
2011-07-06 * Test case.Eelco Dolstra2-0/+8
2011-01-14 * builtins.substring: if "start" is beyond the end of the string,Eelco Dolstra2-1/+3
return the empty string.
2010-10-24 * Keep attribute sets in sorted order to speed up attribute lookups.Eelco Dolstra1-1/+1
* Simplify the representation of attributes in the AST. * Change the behaviour of listToAttrs() in case of duplicate names.
2010-10-23 * Regression test for listToAttr's behaviour if an attribute nameEelco Dolstra2-2/+3
occurs multiple times.
2010-10-22 * Regression test for __overrides.Eelco Dolstra2-0/+10
2010-05-12 * Print attributes in sorted order.Eelco Dolstra1-1/+1
2010-05-12 * Implemented tryEval, the last missing primop in the fast-evalEelco Dolstra2-0/+6
branch. Also added a test for tryEval.
2010-05-07 * Sync with the trunk.Eelco Dolstra4-0/+4
2010-04-22 * Check for duplicate attribute names / function arguments. `makeEelco Dolstra3-1/+10
check' now succeeds :-) * An attribute set such as `{ foo = { enable = true; }; foo.port = 23; }' now parses. It was previously rejected, but I'm too lazy to implement the check. (The only reason to reject it is that the reverse, `{ foo.port = 23; foo = { enable = true; }; }', is rejected, which is kind of ugly.)
2010-04-21 * Update the expected test output (no longer an ATerm).Eelco Dolstra34-34/+34
2010-04-21 * Because --parse-only no longer produces an ATerm, don't check theEelco Dolstra5-5/+0
output. Whether it parses at all should be enough.
2010-03-31 (no commit message)Eelco Dolstra1-1/+0
2010-03-31 * Fix the broken test for listToAttrs.Eelco Dolstra2-2/+5
2010-03-31 Make source location info in the XML output optional.Ludovic Courtès2-0/+4
* src/libexpr/expr-to-xml.cc (nix::showAttrs): Add `location' parameter. Provide location XML attributes when it's true. Update callers. (nix::printTermAsXML): Likewise. * src/libexpr/expr-to-xml.hh (nix::printTermAsXML): Update prototype; have `location' default to `false'. * src/nix-instantiate/nix-instantiate.cc (printResult, processExpr): Add `location' parameter; update callers. (run): Add support for `--no-location'. * src/nix-instantiate/help.txt: Update accordingly. * tests/lang.sh: Invoke `nix-instantiate' with `--no-location' for the XML tests. * tests/lang/eval-okay-toxml.exp, tests/lang/eval-okay-to-xml.nix: New files.
2010-03-25 * Simplify @-patterns: only `{attrs}@name' or `name@{attrs}' are nowEelco Dolstra6-17/+10
allowed. So `name1@name2', `{attrs1}@{attrs2}' and so on are now no longer legal. This is no big loss because they were not useful anyway. This also changes the output of builtins.toXML for @-patterns slightly.
2010-03-23 * Doh.Eelco Dolstra2-20/+8
2010-03-23 * Test "with as; with bs;" since nobody knows what its semantics is.Eelco Dolstra1-1/+19
2009-09-15 * Two primops: builtins.intersectAttrs and builtins.functionArgs.Eelco Dolstra2-0/+95
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-05-15 * Change the scoping of "inherit (e) ..." in recs so that theEelco Dolstra2-0/+7
attributes of the rec are in scope of `e'. This is useful in expressions such as rec { lib = import ./lib; inherit (lib) concatStrings; } It does change the semantics of expressions such as let x = {y = 1;}; in rec { x = {y = 2;}; inherit (x) y; }.y This now returns 2 instead of 1. However, no code in Nixpkgs or NixOS seems to rely on the old behaviour.
2009-05-15 * Some syntactic sugar for attribute sets: allow {x.y.z = ...;} as aEelco Dolstra5-0/+35
shorthand for {x = {y = {z = ...;};};}. This is especially useful for NixOS configuration files, e.g. { services = { sshd = { enable = true; port = 2022; }; }; } can now be written as { services.sshd.enable = true; services.sshd.port = 2022; } However, it is currently not permitted to write { services.sshd = {enable = true;}; services.sshd.port = 2022; } as this is considered a duplicate definition of `services.sshd'.
2008-08-14 * Added an experimental feature suggested by Andres: ellipses ("...")Eelco Dolstra7-5/+20
in attribute set pattern matches. This allows defining a function that takes *at least* the listed attributes, while ignoring additional attributes. For instance, {stdenv, fetchurl, fuse, ...}: stdenv.mkDerivation { ... }; defines a function that requires an attribute set that contains the specified attributes but ignores others. The main advantage is that we can then write in all-packages.nix aefs = import ../bla/aefs pkgs; instead of aefs = import ../bla/aefs { inherit stdenv fetchurl fuse; }; This saves a lot of typing (not to mention not having to update all-packages.nix with purely mechanical changes). It saves as much typing as the "args: with args;" style, but has the advantage that the function arguments are properly declared (not implicit in what the body of the "with" uses).
2008-08-14 * @-patterns as in Haskell. For instance, in a function definitionEelco Dolstra5-0/+32
f = args @ {x, y, z}: ...; `args' refers to the argument as a whole, which is further pattern-matched against the attribute set pattern {x, y, z}.
2008-08-14 * Refactoring: combine functions that take an attribute set andEelco Dolstra5-10/+16
functions that take a single argument (plain lambdas) into one AST node (Function) that contains a Pattern node describing the arguments. Current patterns are single lazy arguments (VarPat) and matching against an attribute set (AttrsPat). This refactoring allows other kinds of patterns to be added easily, such as Haskell-style @-patterns, or list pattern matching.
2008-08-11 * Removed the "valid values" feature. Nobody uses it anyway.Eelco Dolstra8-34/+4
2008-07-11 * Generalised the dependencyClosure primop to builtins.genericClosure,Eelco Dolstra3-0/+380
which is hopefully more useful. * New primops: length, mul, div.
2008-07-01 * Export the nix-env derivation name parsing and version comparisonEelco Dolstra3-0/+43
logic through the `parseDrvName' and `compareVersions' primops. This will allow expressions to easily check whether some dependency is a specific needed version or falls in some version range. See tests/lang/eval-okay-versions.nix for examples.
2008-02-05 * Doh.Eelco Dolstra1-1/+1
2008-02-05 * Regression test.Eelco Dolstra2-2/+9
2008-01-04 * New primop `unsafeDiscardStringContext' to get rid of stringEelco Dolstra2-0/+7
contexts. Needed to prevent unnecessary dependencies when building the NixOS manual.
2007-12-06 * Syntax to escape '', ${.Eelco Dolstra2-2/+8
2007-11-30 * Added a new kind of multi-line string literal delimited by twoEelco Dolstra2-0/+108
single quotes. Example (from NixOS): job = '' start on network-interfaces start script rm -f /var/run/opengl-driver ${if videoDriver == "nvidia" then "ln -sf ${nvidiaDrivers} /var/run/opengl-driver" else if cfg.driSupport then "ln -sf ${mesa} /var/run/opengl-driver" else "" } rm -f /var/log/slim.log end script ''; This style has two big advantages: - \, ' and " aren't special, only '' and ${. So you get a lot less escaping in shell scripts / configuration files in Nixpkgs/NixOS. The delimiter '' is rare in scripts (and can usually be written as ""). ${ is also fairly rare. Other delimiters such as <<...>>, {{...}} and <|...|> were also considered but this one appears to have the fewest drawbacks (thanks Martin). - Indentation is intelligently stripped so that multi-line strings can follow the nesting structure of the containing Nix expression. E.g. in the example above 6 spaces are stripped from the start of each line. This prevents unnecessary indentation in generated files (which sometimes even breaks things). See tests/lang/eval-okay-ind-string.nix for some examples.