# A NixOS module which exposes custom packages to other modules.
{ pkgs, ...}:
let
  # Get our custom packages; either from the nixpkgs attribute added via an
  # overlay in `morph/lib/default.nix`, or by importing them directly.
  ourpkgs = pkgs.ourpkgs or (pkgs.callPackage ../pkgs {});
in {
  config = {
    # Expose `nixos/pkgs` as a new module argument `ourpkgs`.
    _module.args.ourpkgs = ourpkgs;
    # Also expose it as a config setting, for usage by tests,
    # since the `_module` config is not exposed in the result.
    passthru.ourpkgs = ourpkgs;
  };
}