Send in your ideas. Deadline October 1, 2024
Theme fund: NGI Assure
Start: 2023-04
More projects like this
Software engineering

Type Inference for Nix

Adding static typing and type inference to Nix

Nix is a tool to configure systems and manage packages. It comes with a programming language, also called Nix, to describe packages and configurations. Typically, when a change is made to the configuration of a system, the new configuration is evaluated and then applied. However, configuration errors are only reported after the failure of the evaluation. So, users often have to edit the configuration, evaluate it, understand the evaluation errors, fix the errors and try again. This feedback loop is very inefficient and frustrating for users. Similarly, developing the abstractions to make the Nix package collection (nixpkgs) work can be challenging. Indeed, dynamically typed languages with reflection like Nix do not provide many safeguards.

This project aims to retrofit a static type system, with type inference, on the existing Nix language while being backwards compatible with existing code. Types provide timely feedback to developers to help them during development, thanks to localized error messages. Furthermore, a type system for Nix would supercharge language server protocols and provide immediate feedback to Nix programmers. In addition to acting as some form of documentation, static types enable new exiting possibilities like better optimizations for Tvix in order to get faster evaluation and more advanced type-based function search with Noogle.

  • The project's own website:

Logo NLnet: abstract logo of four people seen from above Logo NGI Assure: letterlogo shaped like a tag

This project was funded through the NGI Assure Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 957073.