Strategy for grouping packages together in nixpkgs

Hi - I am looking at maintaining the packages for Ory. The Ory identity and access management ecosystem is separated into 6 components:

  1. Kratos (identity server)
  2. Oathkeeper (identity access proxy)
  3. Polis (saml provider)
  4. Hydra (oauth2 provider)
  5. Keto (permissions)
  6. Ory CLI (command line utility)

Currently, 4 out of 6 of the components exist in nixpkgs:

  1. Kratos (pkgs/by-name/kr/package.nix)
  2. Oathkeeper (pkgs/by-name/oa/oathkeeper/package.nix)
  3. Keto (pkgs/by-name/ke/keto/package.nix)
  4. Ory CLI (pkgs/by-name/or/ory/package.nix)

Hydra currently does not exist but is currently in review – ory-hydra: init at 25.4.0 by debtquity · Pull Request #495436 · NixOS/nixpkgs · GitHub. It will be located under pkgs/by-name/or/ory-hydra/package.nix. It does not use hydra since that package name is already occupied by the nix continuous build system package.

Given the one name conflict and how all of these components are spread out across nixpkgs. Does it make sense to co-locate these packages under a single directory pkgs/by-name/or/ory?

pkgs/by-name/or/ory/package.nix (entrypoint)
pkgs/by-name/or/ory/cli.nix
pkgs/by-name/or/ory/kratos.nix
pkgs/by-name/or/ory/oathkeeper.nix
pkgs/by-name/or/ory/polis.nix
pkgs/by-name/or/ory/keto.nix
pkgs/by-name/or/ory/hydra.nix

Follow up question, has anything like this been done in the past? I tried searching for examples in nixpkgs but I do not have any other projects in mind that have similar structure.

possible solution:

  • treat pkgs/by-name/or/ory/package.nix (cli) as top level package
  • leverage passthru and invoke the other components in that directory

example:

# pkgs/by-name/or/ory/package.nix

{
  buildPackage,
}:

buildGoModule (finalAttrs: {
  pname = "ory";
  # ...
  passthru = {
    kratos = callPackage ./kratos.nix
  };
})
# pkgs/by-name/or/ory/kratos.nix

{
  ...
}:

buildGoModule (finalAttrs: {
  pname = "kratos";
  # ...
})

output here should be 2 packages:

  • pkgs.ory
  • pkgs.ory-kratos