Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brainstorming Base API #1

Open
Pacman99 opened this issue Dec 24, 2022 · 0 comments
Open

Brainstorming Base API #1

Pacman99 opened this issue Dec 24, 2022 · 0 comments

Comments

@Pacman99
Copy link
Member

Pacman99 commented Dec 24, 2022

Current API involves inputsExtender and exporter objects.

inputsExtender objects can use self.initInputs to set an inputs attribute. All the inputs attributes will be merged to create the final inputs set passed to exports. Inputs passed to inputsExtender will be de-systemized.

Exporter objects can use self.inputs and self.system to set an exports attribute. If an exporter doesn't want its exports to be system-spaced then system can be set to whatever system inputs should be passed for. For example a nixosConfigurations exporter could set the system to the one it will build configurations for.

The flake object extends both objects above and adds functionality to manage a list of inputsExtenders and exporters. A flake object is initialized for a specific system. It's inputs attr is the final inputs created by the inputsExtenders and it will be passed to all exporters. The exports attr merges all exporters together into exports meant to be system-spaced and general exports.

To finally build outputs for your flake with proper system-spacing, you can call the outputsForSystems method in the flake object - after you have added your inputsExtenders and exporters with the add* methods.

The goal is for this to be very minimal and generic so it can be built upon. I can imagine a host exporter that implements digga-like features. Or an exporter that loads in cells and blocktypes to build exports like std. Since exporters themselves are objects, they can have their own methods that users can call before adding it to their flake object.

I have an very simple example flake definition, that somewhat outlines how this all works,

flops/flake.nix

Line 212 in 4649807

exampleFlake = {
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant