|
|
|
|
|
by chriswarbo
3677 days ago
|
|
I've not played with node.js since the very early days, and never really used NPM. However, I do see the need for modular, composable shell scripts. Personally, I've been using Nix in a similar way, since it also has nice features like caching, laziness, splicing into indented strings, dependency management, etc. For example, if you have a Nix expression stored in "my-script.nix" you can use the following (e.g. in "my-script.sh") to invoke it: nix-instantiate --read-write-mode --show-trace --eval -E 'import ./my-script.nix'
The `--eval` tells Nix to evaluate an expression, rather than build a package. `-E` is the expression to evaluate (in this case, importing our "script" file). `--read-write-mode` allows the script to add things to the Nix store. `--show-trace` is to aid debugging. |
|
That sounds pretty cool, how does it work? Does it match the indentation of the parent that issued the splice for the entire child? How about nested splices?