Reading INI files

Hello everybody,

I found a lot of posts about converting from/to JSON, YAML, TOML, etc…

But strangely I can’t find anything about reading INI - which should be much easier than for example TOML that is kind of a supercharged INI…

I also found lib.generators.toINI but I want to read INI, not to create it :wink: .

Could you please help how to convert INI plain text to NIX attr. set?

Thank you.

There is no exact definition for ini. It would be impossible to read all possible variations of ini with just one function, but a lot of ini files should work with TOML too. If you can’t read it with builtins.fromTOML, you have to write your own parser i think.

Thank you @quantenzitrone

I can’t use fromTOML since this works:

builtins.fromTOML "a=\"abc\""

but this doesn’t:

builtins.fromTOML "a=abc"

and I think that most INI variations don’t use quotes around strings.