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.
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
andhomeModules
.The current
flake.nix
in this package set doesn't export that. It is however being done innixpkgs-matrix-private
.We would want to do it here, and have
nixpkgs-matrix-private
inherit that.So this
flake.nix
should takenixosModules
andhomeModules
frompolykey-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 itdeps.nix
or something.Then create
modules.nix
, and that should define modules, in this case referencing thedeps.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 samedeps.nix
...? Or at least load the same/nix/store
path.Anyway, then we can share the flake output from
deps.nix
betweenpackages.nix
andmodules.nix
.Additional context
Tasks
deps.nix
and usebuiltins.getFlake
to lazily get flakes.packages.nix
andmodules.nix
nixosModules
andhomeModules
out ofnixpkgs-matrix
- make sure to get thepolykey-cli
onesnixpkgs-matrix-private
can use the output and extend itpolykey-cli
innixpkgs-matrix-private
.