tvl-depot/tvix/docs/lang-version.md
sterni 0128323c55 docs(tvix): mention langVersion >= 5 check in nixpkgs
Change-Id: I7aae900012e901fa4d886b1a4bf0657d593e4983
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8771
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2023-06-14 10:55:55 +00:00

2.8 KiB

Nix language version history

The Nix language (“Nix”) has its own versioning mechanism independent from its most popular implementation (“C++ Nix”): builtins.langVersion. It has been increased whenever the language has changed syntactically or semantically in a way that would not be introspectable otherwise. In particular, this does not include addition (or removal) of builtins, as this can be introspected using standard attribute set operations.

Changes to builtins.langVersion are best found by viewing the git history of C++ Nix using git log -G 'mkInt\\(v, [0-9]\\)' for builtins.langVersion < 7. After that point git log -G 'v\\.mkInt\\([0-9]+\\)' should work. To reduce the amount of false positives, specify the version number you are interested in explicitly.

1

The first version of the Nix language is its state at the point when builtins.langVersion was added in 8b8ee53 which was first released as part of C++ Nix 1.2.

2

Nix version 2 changed the behavior of builtins.storePath: It would now try to substitute the given path if missing, instead of creating an evaluation failure. builtins.langVersion was increased in e36229d.

3

Nix version 3 changed the behavior of the == behavior. Strings would now be considered equal even if they had differing string context.

4

Nix version 4 added the float type to the language.

5

The increase of builtins.langVersion to 5 did not signify a language change, but added support for structured attributes to the Nix daemon. Eelco Dolstra writes as to what changed:

The structured attributes support. Unfortunately that's not so much a language change as a build.cc (i.e. daemon) change, but we don't really have a way to express that...

Maybe builtins.nixVersion (which was added in version 1) should have been used instead. In any case, the only langVersion check in nixpkgs verifies a lower bound of 5.

6

Nix version 6 added support for comparing two lists.