depot/pkgs/by-name/ca/cargo-typify/package.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

58 lines
1.2 KiB
Nix

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