Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2024-08-09 16:19:53 -07:00
{
lib,
rustfmt,
rustPlatform,
fetchFromGitHub,
gitUpdater,
makeWrapper,
}:
2023-12-09 16:31:47 -10:00
rustPlatform.buildRustPackage rec {
pname = "cargo-typify";
2024-08-09 16:19:53 -07:00
version = "0.1.0";
2023-12-09 16:31:47 -10:00
src = fetchFromGitHub {
owner = "oxidecomputer";
repo = "typify";
rev = "v${version}";
2024-08-09 16:19:53 -07:00
hash = "sha256-vokhWIY5iikTyADrqxp6DIq+tJ+xdFPebDFTddJnstA=";
2023-12-09 16:31:47 -10:00
};
cargoHash = "sha256-1qxWFyA9xCnyDES27uj7gDc5Nf6qdikNkpuf/DP/NAU=";
2023-12-09 16:31:47 -10:00
2024-08-09 16:19:53 -07:00
nativeBuildInputs = [
rustfmt
makeWrapper
];
2023-12-09 16:31:47 -10:00
2024-08-09 16:19:53 -07:00
cargoBuildFlags = [
"--package"
"cargo-typify"
];
cargoTestFlags = [
"--package"
"cargo-typify"
];
strictDeps = true;
2023-12-09 16:31:47 -10:00
preCheck = ''
# cargo-typify depends on rustfmt-wrapper, which requires RUSTFMT:
export RUSTFMT="${lib.getExe rustfmt}"
'';
2024-08-09 16:19:53 -07:00
postInstall = ''
wrapProgram $out/bin/cargo-typify \
--set RUSTFMT "${lib.getExe rustfmt}"
'';
passthru.updateScript = gitUpdater { rev-prefix = "v"; };
2024-08-09 16:19:53 -07:00
meta = {
2023-12-09 16:31:47 -10:00
description = "JSON Schema to Rust type converter";
mainProgram = "cargo-typify";
2023-12-09 16:31:47 -10:00
homepage = "https://github.com/oxidecomputer/typify";
2024-08-09 16:19:53 -07:00
license = with lib.licenses; [ asl20 ];
maintainers = with lib.maintainers; [ david-r-cox ];
2023-12-09 16:31:47 -10:00
};
}