nickel-lang / organist

Control all your tooling from a single console
MIT License
404 stars 20 forks source link

Export nickel schema to nix? #191

Open abueide opened 6 months ago

abueide commented 6 months ago

Hi,

Is there a straightforward way to export a nickel expression containing a list of my machines to a simple nix expression like you can with json, toml etc? It'd be cool to have my systems defined in a nickel expression then be able to export them to json for my ci/cd pipeline and to nix for my actual build configurations.

let { SystemSchema, .. } = import "system-schema.ncl" in
let { NetworkSchema, .. } = import "../networks/network-schema.ncl" in
let abyslNetworks = import "../networks/networks.ncl" in
{
    zitadel | SystemSchema = { host = "zitadel", ip = "10.0.22.2", networks = [ abyslNetworks.public ] },
}
YorikSar commented 6 months ago

Nix is not a great format for data transfer between systems. I’d recommend exporting data to JSON and loading it from it in Nix using builtins.fromJSON.