nixpkgs/pkgs/by-name/ca/cargo-typify/package.nix

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

59 lines
1.2 KiB
Nix
Raw Normal View History

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