Age | Commit message (Collapse) | Author |
|
|
|
contexts. Needed to prevent unnecessary dependencies when building
the NixOS manual.
|
|
|
|
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.
|
|
|
|
new configuration style proposal in lib/default-unstable.nix
|
|
bla'). Also allow trailing commas (`{x, y,}: ...') as a unintented
consequence. Hopefully the reduce/reduce conflict won't cause any
problems.
|
|
* `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.
|
|
|
|
info, sort attribute sets.
|
|
names of the attributes in an attribute set.
|
|
|
|
the semantic changes.
|
|
kind of notation for strings.
|
|
|
|
* Primop `pathExists' to check for path existence.
|
|
|
|
|
|
* Put common test functions in tests/lang/lib.nix.
|
|
With this primitive, a list-flattening function can be implemented
(NIX-55, example is in tests/lang/eval-okay-flatten.nix).
|
|
list. Useful for lots of things, such as implementing a fold
function (see NIX-30, example is in tests/lang/eval-okay-list.nix).
|
|
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)
|
|
bad flex doesn't have lexical restrictions, the current solution
isn't quite right...)
|
|
|
|
evaluate its arguments.
|
|
an XML representation stored in a string. This should be useful to
pass structured information to builders.
|
|
|
|
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 ...'.
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
evaluation fails:
error: impossible: undefined variable `gcc'
|
|
of the function. Implements NIX-45.
|
|
|
|
|
|
"--with-freetype2-library=" + freetype + "/lib"
can now be written as
"--with-freetype2-library=${freetype}/lib"
An arbitrary expression can be enclosed within ${...}, not just
identifiers.
* Escaping in string literals: \n, \r, \t interpreted as in C, any
other character following \ is interpreted as-is.
* Newlines are now allowed in string literals.
|
|
configureFlags = "--with-freetype2-library="
+ freetype + "/lib";
|
|
|
|
|
|
|
|
[1 2 3] ++ [4 5 6] => [1 2 3 4 5 6]
|
|
`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.
|
|
expressions.
|
|
* Don't use local file names in tests since they will produce
different parse trees depending on the current directory.
|
|
regexp there could be only one such comment per file.
|
|
* Add automated Nix expression language tests.
|