Description
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
- Create
deps.nix
and usebuiltins.getFlake
to lazily get flakes. - Share the output between
packages.nix
andmodules.nix
- Export
nixosModules
andhomeModules
out ofnixpkgs-matrix
- make sure to get thepolykey-cli
ones - Ensure that
nixpkgs-matrix-private
can use the output and extend it - Remove the unnecessary flake input on
polykey-cli
innixpkgs-matrix-private
.