{
  lib,
  rustPlatform,
  glibc,
  nixVersions,
  pkg-config,
  rustc,
}:
let
  inherit (rustc) llvmPackages;
  nixForBindings = nixVersions.latest;
in
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "evix";
  version = "0.1.0";

  src = let
    fs = lib.fileset;
    s = ../.;
  in
    fs.toSource {
      root = s;
      fileset = fs.unions [
        (s + /src)
        (s + /Cargo.lock)
        (s + /Cargo.toml)
      ];
    };

  cargoLock.lockFile = "${finalAttrs.src}/Cargo.lock";
  enableParallelBuilding = true;

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs = [
    nixForBindings.dev
    glibc.dev
  ];

  env = {
    LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
    BINDGEN_EXTRA_CLANG_ARGS = "--sysroot=${glibc.dev}";
  };

  meta = {
    description = "Evaluate a Nix expression and stream derivation info as JSON lines";
    mainProgram = "evix";
    license = lib.licenses.eupl12;
    maintainers = with lib.maintainers; [NotAShelf];
  };
})
