den icon indicating copy to clipboard operation
den copied to clipboard

flake-packages are not exported unless they are included.

Open body20002 opened this issue 6 months ago • 3 comments

steps to reproduce:

  1. git clone https://github.com/body20002/denful-flake-packages-not-exported-by-default
  2. mv modules/system.nix modules/_system.nix
  3. nix flake show

the nix flake show output doesn't show the hello package for it to show you'll have to include it

  1. mv modules/_system.nix modules/system.nix
  2. nix flake show

I believe this is a bug.

body20002 avatar Jun 01 '26 16:06 body20002

replacing den.schema.flake-packages with den.schema.flake-system seems to work. Is this intentional?

body20002 avatar Jun 01 '26 18:06 body20002

Thanks for the clear repro, @body20002. You did nothing wrong here, this is a mistake in our docs.

The flake output reference tells you to write den.schema.flake-packages.includes = [ ... ], but flake-packages is not a real schema kind. The registered kinds are flake, flake-system, flake-parts, and default. Since den.schema is freeform, the bad kind is silently accepted and nothing ever resolves to it, so the includes are never walked. It does nothing.

That is why the package only showed up with modules/system.nix present: the host in that file pulled in den.aspects.hello via den.aspects.test.includes. The schema line was never doing the work, the host was. Remove the host and the package disappears.

Your workaround is exactly the intended API:

den.schema.flake-system.includes = [ den.aspects.hello ];

flake-system is instantiated once per system, the included aspect resolves at each per-system scope, and the per-output routes carry the class output to the flake, no host required. Confirmed it exports hello for every system in your repro with system.nix removed.

Doc fix is up in #587.

sini avatar Jun 01 '26 21:06 sini

Thank you for the clarification.

body20002 avatar Jun 02 '26 09:06 body20002