-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add typed models for projects #507
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looking forward to have some kind of model in tree that we can start iterating on.
We might want to consider adding extensive doc comments in projects/models.nix
, as this is a file that is likely to be looked at by contributors a lot.
Also I'm not sure I yet understand the exact scope of the project model. Is it supposed to eventually contain only the external data we get from NLnet or also the kind of information that we have from the package set itself, e.g. versions, vulnerabilities, labels?
Types shouldn't also be `any`.
This is not only much cleaner and more readable than the previous approach, but it also ensures that only the specified fields are allowed in the data model.
First, each program and service should have at least one example, that's why we require that the attribute is non empty. Second, we allow examples to be null in order to express that it's something needed, but not yet available.
The code looks much cleaner now after using structs and it should also be more robust since only the modeled attributes will be allowed. The included example should also be more useful now since it details how things fit together and how the structure will actually look like. PS: I tried to add some requirements from ngi-nix/summer-of-nix#163, but there are some things I'm not certain about like how to implement the |
Can be tested with:
nix-instantiate --eval --strict --expr "let self = import ./default.nix {}; in self.project-models.example"
You can also use watchexec to continuously monitor the output as the file changes:
watchexec '<COMMAND>'
If this is the correct way to go, project deliverables will be added next.