[Nix-dev] nix configuration language

Ben Franksen ben.franksen at online.de
Mon Apr 23 12:42:14 CEST 2012


Marc Weber wrote:
> Excerpts from Ben Franksen's message of Mon Apr 23 10:53:26 +0200 2012:
>> Would it be sensible or even possible to factor out the configuration
>> language from the nix package and distribute it separately?
> Such things are always possible. I think you should talk about your use
> case first.

Large control systems: many devices (hundreds, thousands), most of them 
quite similar to each other, but now and then the occasional exception to 
the rule. A few devices very complex, needing hierarchies of configuration 
data.

> Eventually using another lazy language such as Haskell get's
> your job done as well.

I love programming in Haskell, but it is too large and complex for use as a 
configuration language. It also too hard to understand for the typical 
control system engineer.

> That's why you should be aware about why the nix
> language is the tool of choice for you

Well, I see nix (the language) as something like yaml or json (only smaller 
and cleaner) with the additional feature of user-defined functions (and some 
built-in ones). Nix has a number of features that make it especially 
suitable for configuration (no wonder: it's what it has been designed for), 
for instance the inherit feature which makes it easy to define exceptions to 
a general rule.

> Writing a DSL for configurations can be done easily using many scripting
> languages - thus you should be aware why you like nix that much.

Mostly it's the purity and laziness that make it IMO superior to the 
standard scripting languages. We have been using perl, python, tcl, but none 
of them are as suited to the task as I think the nix language would be.

> For prototyping you can use nix and make it create arbitrary
> configuration files.

I don't know how I can execute a 'nix-language script'. Is there a tool in 
the nix package that I could use for that?

I would not want to fork the configuration language from nix, but rather 
factor the language out, so users who only need/want the language can still 
profit from improvements made by the nix development.

Do you think it would be very difficult to extract the language from the nix 
source tree?

Cheers
Ben



More information about the nix-dev mailing list