nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 58 lines 1.2 kB view raw
1{ 2 lib, 3 rustfmt, 4 rustPlatform, 5 fetchFromGitHub, 6 gitUpdater, 7 makeWrapper, 8}: 9 10rustPlatform.buildRustPackage rec { 11 pname = "cargo-typify"; 12 version = "0.1.0"; 13 14 src = fetchFromGitHub { 15 owner = "oxidecomputer"; 16 repo = "typify"; 17 rev = "v${version}"; 18 hash = "sha256-vokhWIY5iikTyADrqxp6DIq+tJ+xdFPebDFTddJnstA="; 19 }; 20 21 cargoHash = "sha256-1qxWFyA9xCnyDES27uj7gDc5Nf6qdikNkpuf/DP/NAU="; 22 23 nativeBuildInputs = [ 24 rustfmt 25 makeWrapper 26 ]; 27 28 cargoBuildFlags = [ 29 "--package" 30 "cargo-typify" 31 ]; 32 cargoTestFlags = [ 33 "--package" 34 "cargo-typify" 35 ]; 36 37 strictDeps = true; 38 39 preCheck = '' 40 # cargo-typify depends on rustfmt-wrapper, which requires RUSTFMT: 41 export RUSTFMT="${lib.getExe rustfmt}" 42 ''; 43 44 postInstall = '' 45 wrapProgram $out/bin/cargo-typify \ 46 --set RUSTFMT "${lib.getExe rustfmt}" 47 ''; 48 49 passthru.updateScript = gitUpdater { rev-prefix = "v"; }; 50 51 meta = { 52 description = "JSON Schema to Rust type converter"; 53 mainProgram = "cargo-typify"; 54 homepage = "https://github.com/oxidecomputer/typify"; 55 license = with lib.licenses; [ asl20 ]; 56 maintainers = with lib.maintainers; [ david-r-cox ]; 57 }; 58}