{
  # nixpkgs dependencies
  lib, stdenv, cmake, catch2,

  # xo dependencies
  xo-object2,
  xo-reflect,
  xo-alloc2,
  xo-facet,
  xo-subsys,
  xo-cmake,
  doCheck ? true,
} :

stdenv.mkDerivation (finalattrs:
  {
    name = "xo-type";

    src = ../xo-type;

    cmakeFlags = ["-DCMAKE_MODULE_PATH=${xo-cmake}/share/cmake"]
                 ++ lib.optionals doCheck ["-DENABLE_TESTING=1"];

    inherit doCheck;

    nativeBuildInputs = [
      cmake catch2
      xo-cmake
    ];
    propagatedBuildInputs = [
      xo-object2
      xo-reflect
      xo-alloc2
      xo-subsys
      xo-facet
    ];
  })
