snix/web/content/docs/reference/nix-language/lang-version.md
Florian Klink 21628f7ad4 docs(web): migrate language-spec,lang-version,value-pointer-equality
Change-Id: I2008d4d5d92dc02f3955828ba93f748282948f07
Reviewed-on: https://cl.snix.dev/c/snix/+/30447
Autosubmit: Florian Klink <flokli@flokli.de>
Reviewed-by: Vova Kryachko <v.kryachko@gmail.com>
Tested-by: besadii
2025-05-04 17:26:22 +00:00

3 KiB

title slug description summary date lastmod draft weight toc
Version history lang-version 2025-05-01T13:10:37+02:00 2025-05-01T13:10:37+02:00 false 50 false

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.