MatrixAI / nixpkgs-matrix

A public nixpkgs/flakes package collection for Matrix AI.
https://matrix.ai
Apache License 2.0
2 stars 0 forks source link

Expose `nixosModules` and `homeModules` in nixpkgs-matrix for OS packages #6

Open CMCDragonkai opened 3 days ago

CMCDragonkai commented 3 days ago

Specification

We discussed previously that in the case of flake.nix there can be many kinds of "outputs"/exports.

This includes not just packages, but also nixosModules and homeModules.

The current flake.nix in this package set doesn't export that. It is however being done in nixpkgs-matrix-private.

We would want to do it here, and have nixpkgs-matrix-private inherit that.

So this flake.nix should take nixosModules and homeModules from polykey-cli package and also export it out.

However we would not want to do it directly via flake inputs, we know that flake inputs are eager, and as a package set, we would want to avoid having to eagerly load all input packages. Instead it should be using builtins.getFlake like we are currently doing in /packages.nix.

I propose that builtins.getFlake gets abstracted out. You could call it deps.nix or something.

Then create modules.nix, and that should define modules, in this case referencing the deps.nix output. Ideally we can share it.

I'm not sure what would happen if you just import deps.nix twice in 2 places, I suspect that the nix runtime should share the same object structure, since it's the same deps.nix...? Or at least load the same /nix/store path.

Anyway, then we can share the flake output from deps.nix between packages.nix and modules.nix.

Additional context

Tasks

  1. Create deps.nix and use builtins.getFlake to lazily get flakes.
  2. Share the output between packages.nix and modules.nix
  3. Export nixosModules and homeModules out of nixpkgs-matrix - make sure to get the polykey-cli ones
  4. Ensure that nixpkgs-matrix-private can use the output and extend it
  5. Remove the unnecessary flake input on polykey-cli in nixpkgs-matrix-private.
linear[bot] commented 3 days ago

INF-102 Expose `nixosModules` and `homeModules` in nixpkgs-matrix for OS packages