[Nix-dev] Dynamic Nix Expression Configuration
Roger Qiu
roger.qiu at polycademy.com
Fri Jul 4 05:24:59 CEST 2014
Hello everybody,
What's the best way to send configuration parameters to Nix expressions?
Say I have a tool (a bash script) that dynamically generates nix
expressions based on other runtime factors.
I can use the sed tool to find/replace some properties inside the
`x.nix` files. But this can become a mess of unmaintainable regular
expressions.
I would prefer to be able to instead write a config file with a standard
schema, and then get Nix to import this, rather than using regular
expressions.
This could be JSON. But it could also just a be a file with a list
inside it.
I looked at the Nix Manual and found a few "builtins" functions. None of
them seemed to be able to parse config or even a simple list in a static
file.
I saw there was a toJSON and toXML, why not fromXML or fromJSON, or even
just fromFileList or some functions that can parse text.
Barring that, perhaps is there a Nix expression parser that can be
dynamically used?
Thanks,
Roger
--
Founder of Polycademy & SnapSearch
http://polycademy.com
https://snapsearch.io
+61420925975
More information about the nix-dev
mailing list