Other configuration languages like Nix

Hello,

I have two questions about whether there any similar configuration languages like Nix that allow for the following:

Let’s say we have two modules: Module A and Module B.

Module A does the following:

config.foo = [“bar”];

Module B does the following:

config.foo = [“baz”];

If I now merge these two NixOS modules (NixOS modules - NixOS Wiki) the result of config.foo is as follows:

config.foo = [“bar” “baz”]

The first question is: are there any another configuration languages which allows to merge these two “by default”, just like I did not have to configure anything to get this behavior?

However, if we then make it more interesting: and change the code of Module B to the following:

config.foo = [
lib.optionalString (length config.foo > 0) “baz”
];

This still outputs [“bar” “baz”], regardless whether I have imported Module A first or Module B first. The order of importing does not matter in this case.

The second question is: are there any another configuration languages which allow me to change the configuration regardless whether I have imported that “module” earlier or later than another module?

Thank you for your time.

I believe https://cuelang.org/ should qualify?

GitHub - tweag/nickel: Better configuration for less also looks pretty promising