My current project is: https://github.com/keithy/nickel-compose and it is going well.
Generally most use-cases I have for nickel require that I construct a full script snippet and feed this to nickel eval, we have first class functions, yet we have no easily usable equivalent of jq. To me this appears to be a fixable oversight. (Please correct me if I am wrong.)
Suggestion 1: Include a default dispatcher for plugins.
I have written nickel-compose, a dispatcher that I invoke but if nickel had a native dispatcher, that delegates to other nickel- executables on the PATH, I think this would pave the way for a range of useful features under the nickel banner.
For example: I do think that fixing docker-compose could put nickel on the map, its certainly worth a couple of medium.com articles.
[Example: Here is a generic dispatcher that I wrote earlier for sensible (not-ansible) in go (https://github.com/keithy/sensible/blob/main/cmd/sensible/main.go]
Suggestion 2: Make simple queries simple(r)
- Simplest — load one file, query a field (imagined invocation once implemented)
nickel run config=my-config.ncl -- config.user
Current bash implementation builds a temporary wrapper:
let config = import "/abs/path/to/my-config.ncl" in
let _paths = { config = "/abs/path/to/my-config.ncl" } in
config.user
- Apply a Nickel stdlib function to the loaded file (current invocation using shell script)
./bin/nickel-run.sh composed=compose.ncl -- 'std.record.fields composed.services'
Prints the list of service names ( ["web", "db", ...] ).
- Pipe through nickel export for YAML/JSON output
bin/nickel-run.sh --format yaml composed=compose.ncl -- composed.volumes
- Raw values from a config file (better yq than yq?)
$> bin/nickel-run.sh --raw composed=compose.yaml -- compose.web.image
nginx:1.27
And many more besides
A derivative nickel-compose-run that loads a function library as the nickel-compose "engine" (with docker-compose merge compatabilty, networks & volumes synthesis, contracts, and validation functions), and can apply those functions.
nickel-run compose=nickel-compose.ncl cfg=config/prod.ncl -- 'compose.merge_fully_validate cfg _paths.cfg' > compose.ncl
Finally, nickel on its own doesn't do much, so why not make this the default operation?
spec
Minimax-M3 wrote up a spec for nickel run based upon what we have so far https://github.com/keithy/nickel-compose/blob/main/docs/nickel-run.md
My current project is: https://github.com/keithy/nickel-compose and it is going well.
Generally most use-cases I have for nickel require that I construct a full script snippet and feed this to
nickel eval, we have first class functions, yet we have no easily usable equivalent of jq. To me this appears to be a fixable oversight. (Please correct me if I am wrong.)Suggestion 1: Include a default dispatcher for plugins.
I have written
nickel-compose, a dispatcher that I invoke but if nickel had a native dispatcher, that delegates to other nickel- executables on the PATH, I think this would pave the way for a range of useful features under the nickel banner.For example: I do think that fixing docker-compose could put nickel on the map, its certainly worth a couple of medium.com articles.
[Example: Here is a generic dispatcher that I wrote earlier for sensible (not-ansible) in go (https://github.com/keithy/sensible/blob/main/cmd/sensible/main.go]
Suggestion 2: Make simple queries simple(r)
nickel run config=my-config.ncl -- config.userCurrent bash implementation builds a temporary wrapper:
./bin/nickel-run.sh composed=compose.ncl -- 'std.record.fields composed.services'Prints the list of service names ( ["web", "db", ...] ).
$> bin/nickel-run.sh --raw composed=compose.yaml -- compose.web.image nginx:1.27And many more besides
A derivative
nickel-compose-runthat loads a function library as the nickel-compose "engine" (with docker-compose merge compatabilty, networks & volumes synthesis, contracts, and validation functions), and can apply those functions.Finally,
nickelon its own doesn't do much, so why not make this the default operation?spec
Minimax-M3 wrote up a spec for
nickel runbased upon what we have so far https://github.com/keithy/nickel-compose/blob/main/docs/nickel-run.md