-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Is your feature request related to a problem? Please describe.
Some applications' needs aren't fully met by the CLI and its --json flags.
Examples:
- evaluation involving multiple function applications
- applications that have intricate data flows back and forth between Nix and the app
- applications that want to stream evaluation info
- static binaries for single file distribution
Developing and maintaining programs that use the C++ code requires more effort over time, because the C++ api is not stable.
Language bindings that are developed as an integral part of Nix reduce the total maintenance effort by removing the need for multi-version compatibility. Committing to support more interfaces may increase the burden on the team somewhat, except for the Haskell bindings, which are already maintained by a team member, me.
Describe the solution you'd like
We could take one of at least two directions, or keep the status quo.
- Create a stable C facade, and build language bindings on top of that
- Create bindings that interoperate directly with C++
Benefits of going through C
- broader support than C++
- if stable, linking against various versions of Nix is easy
Benefits of talking directly to C++
- performance may be better, especially if the C facade doesn't follow the contours of the C++ interface very closely. String conversions may be inefficient
- talking directly to C++ may be less effort, especially initially as Nix could absorb the hercules-ci-cnix-* Haskell bindings and pythonix
Both approaches are valid simultaneously, considering that a C facade and C bindings are basically the same thing. (Won't be a completely standard C library though, because of libstore's coroutines, libexpr's gc, and libexpr's stack overflow handler)
Describe alternatives you've considered
Status quo:
- Maintenance overhead is higher, potentially leading to more abandoned bindings (like pythonix).
- NixOps will keep suffering from missing data when going back and forth between resources and machine configs in certain ways.
- Executable language spec idea / doctester would have to be implemented in C++.
Additional context