June 21st, 2024

Nickel Modules

Nickel, a programming language inspired by NixOS modules, introduces a merge system for defining complex configurations modularly. It addresses NixOS module system limitations, offering enhanced error handling and consistency for structured configurations.

Read original articleLink Icon
Nickel Modules

Nickel is a programming language that features a merge system allowing the combination of records to define complex configurations in a modular way. Inspired by NixOS modules, Nickel's merge system differs slightly by focusing on combining configurations that adhere to the same contract. While NixOS modules define parts of the final configuration and contract, Nickel aims to provide full modularity similar to NixOS modules. By leveraging the merge system, Nickel can implement an equivalent of the NixOS module system with added benefits like error messages and flexibility. The article discusses the shortcomings of the NixOS module system, such as complex error messages and lack of language support, and proposes a one-line code solution in Nickel to create a module system. This new system ensures global and local consistency, providing early warnings for any inconsistencies. The article concludes by highlighting the power and potential of implementing NixOS-like modules in Nickel for more structured and error-resilient configurations.

Link Icon 5 comments
By @mtlynch - 4 months
There's no explanation of what Nickel is. Even if I click the link, I get:

>Better configuration for less

>Write complex configurations. Modular, correct and boilerplate-free.

I still don't get what this is. Configuration for what? Is this an alternative to TOML/YAML?

From clicking three or four links deep into the Nickel documentation, I finally found an explanation that Nickel is a language for generating configuration files like YAML or TOML.

Either I'm super out of the loop or the authors need to do a better job of explaining what Nickel is from the beginning.

By @aliasxneo - 4 months
I wonder how much Nickel has improved since last year. I attempted to use it to generate some Terraform code, and the experience was less than pleasant. This was largely due to surprising interactions and lack of documentation, ironically making it similar to Nix.

I'm hopeful it will keep improving.

By @1oooqooq - 4 months
i bet this nickel language is awesome and versatile, but that their own employees have hidden bash and python hacky scripts that generate what amounts to 90s-Oracle-consultant-xml levels of verbosity for simple config files just so you can have a test db for ci builds in the end.
By @unshavedyak - 4 months
Coming from Rust, there's still something about those Nickel error messages that don't read as well for me. They're much better than Nix for me, but weirdly they still read a bit busy. Maybe it's just my brain heh.. i can't explain it.

Nonetheless I still am just dying to switch to Nickel from Nix though. I am so tired of not having types in my config language, crappy documentation available to my LSP, etc. The wait for Nickel has been long for me