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

Export packages of a project with their NixOS modules #297

Open
cleeyv opened this issue Jun 20, 2024 · 3 comments
Open

Export packages of a project with their NixOS modules #297

cleeyv opened this issue Jun 20, 2024 · 3 comments

Comments

@cleeyv
Copy link
Collaborator

cleeyv commented Jun 20, 2024

Currently, the packages associated with a project are not included with the nixosModule for that project. The project services will fail with "package is missing" errors if ngipkgs.nixosModules.default (containing all packages) is not also included separately.

@lorenzleutgeb
Copy link
Member

This is done intentionally. Do you have a proposal in mind? I would like to avoid pulling in all packages from NGIpkgs implicitly. Maybe we can synthesize one overlay per Project and pull that instead? Do you have any proposals?

@fricklerhandwerk
Copy link
Collaborator

Yes, so nixosModules.default should just get the entire thing at the cost of eval time, but otherwise every module should only get the packages required for it.

@cleeyv
Copy link
Collaborator Author

cleeyv commented Jun 21, 2024

I would like to avoid pulling in all packages from NGIpkgs implicitly.

Given the current structure of the repo, from a user's perspective I don't see there being much substantial difference between ngipkgs.nixosModules.default being a mandatory piece of boilerplate that they must paste in along with the module they want to use, versus it being included with every one of the modules. And between these two ways of doing it, the implicit option makes a bit more sense in order to meet the expectation that a module contains all of its hard dependencies.

Maybe we can synthesize one overlay per Project and pull that instead? Do you have any proposals?

I'm working on understanding how the repo works, and given my level of familiarity with nixlang there are still many details of what is in the flake.nix that I don't follow very well. That said, I have the general impression that including the currently existing overlay of all ngi packages with each module would be a much simpler modification than synthesizing a new unique overlay for each project. Per-project overlays would require manually creating (or maybe generating) a list of the ngi package dependencies for each project, which as far as I know doesn't exist yet though maybe I'm just missing it.

For example, if I understand correctly, the simpler option of including all the packages in order to make project modules usable is effectively already what is being done to make the nixosTests work, by including the default ngipkgs overlay in the pkgs used in the eachDefaultSystemOutputs: https://github.com/ngi-nix/ngipkgs/blob/main/flake.nix#L138-L142 I imagine that doing something similar for the pkgs used in each project's nixosModule output would be an immediate solution to this issue. I still don't feel confident about how to start implementing this, but figuring that out that feels like it would be the next step.

I agree that further work could also happen to generate per-project overlays, but that seems like a substantially more involved task, though please do let me know if I am misevaluating the difference in complexity between the two potential solutions.

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

3 participants