Confusion about nix language syntax in sample configuration

I’ve seen this in a sample configuration:
services.xserver.layout = "us"; services.xserver.xkbVariant = "altgr-intl";
I wonder what does the nested dot expression mean. I’ve read the manual and didn’t find relevant description. I wonder where is services defined? Is it defined here? What will happen if I try to evaluate it between the two lines? In a pure FP language you cannot modify existing objects, so what is this syntax doing? Thanks!

You are not modifying anything, you are creating an attribute set – note that the whole expression includes the outer braces { }.

Setting nested attributes like this is just a syntactic sugar. It is weird that it is not mentioned in the Attribute Set section of the Nix manual, only a brief mention on the Language page.

1 Like

@jtojnar it‘s described somewhat implicitly in the operators section. The language reference still needs a lot of work;
attribute set documention is not very informative indeed.

@AprilGrimoire feel free to open a documentation issue in the Nix repository or propose a change directly. If you’re interested in contributing, the documentation team will help you along with getting your improvement merged, so fewer people will have to suffer the confusion in the future. :slight_smile:

1 Like