Turns out that https://github.com/srid/devour-flake is just a specific example of a more general idea wherein we define a cross-language function: the function body defined in Nix (as derivation), with flake inputs being "arguments" to it, and the outPath of that derivation as the "return" of the function.
In devour-flake, the input arguments are "flake" (flake to be built) and "systems". We can represent this in Rust as:
pub struct DevourFlakeInput {
/// The flake devour-flake will build
pub flake: FlakeUrl,
/// The systems it will build for. An empty list means all allowed systems.
pub systems: FlakeUrl,
}
Likewise, the return of the function is a file containing all built paths, which in Rust is:
This PR prepares the ground of creating this more generation mechanism, where the entirety of nixci's devour_flake.rs can be generalized so that it can be used for any such function (for example, #51). The result is also simpler to reason about code.
Turns out that https://github.com/srid/devour-flake is just a specific example of a more general idea wherein we define a cross-language function: the function body defined in Nix (as derivation), with flake inputs being "arguments" to it, and the outPath of that derivation as the "return" of the function.
In devour-flake, the input arguments are "flake" (flake to be built) and "systems". We can represent this in Rust as:
Likewise, the return of the function is a file containing all built paths, which in Rust is:
This PR prepares the ground of creating this more generation mechanism, where the entirety of nixci's
devour_flake.rs
can be generalized so that it can be used for any such function (for example, #51). The result is also simpler to reason about code.