Welcome to the new FlakeHub docs experience!
Concepts
Flake schemas

Flake schemas

Flake schemas (opens in a new tab) are a way to tell Nix about the structure of your flake's outputs (opens in a new tab). If you have outputs that are not part of the default schema definitions (see the flake-schemas README (opens in a new tab) for the default flake output types), you can make your own schema, which will show up on your flake's FlakeHub page.

To add flake schemas to your flake, first add a flake input for the flake-schemas (opens in a new tab) flake using fh:

fh add DeterminateSystems/flake-schemas

Or manually:

flake.nix
{
  inputs = {
    flake-schemas = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
 
    # other inputs
  };
}

Then add a schemas output:

flake.nix
{
  outputs = { flake-schemas, ... }: {
    inherit (flake-schemas) schemas;
 
    # other outputs
  };
}

Custom flake schemas

Here is an example flake that defines a schema for its superSpecialPackage output:

{
  inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
 
  outputs = { ... } @ inputs:
    let
      mkChildren = children: { inherit children; };
    in
    {
      superSpecialPackage.x86_64-linux.default = inputs.nixpkgs.legacyPackages.x86_64-linux.hello;
 
      schemas.superSpecialPackage = {
        version = 1;
        doc = "The `superSpecialPackage` output defines a [super special package](https://example.org).";
        inventory = output: mkChildren (
          builtins.mapAttrs
            (systemType: packagesForSystem:
              {
                forSystems = [ systemType ];
                children = builtins.mapAttrs
                  (packageName: package:
                    {
                      forSystems = [ systemType ];
                      what = "super special package";
                      shortDescription = package.meta.description or "";
                      derivation = package;
                      evalChecks.isDerivation =
                        package.type or null == "derivation"
                        && package ? drvPath;
                    })
                  packagesForSystem;
              })
            output);
      };
    };
}