1{ lib
2, rustPlatform
3, fetchCrate
4, installShellFiles
5, stdenv
6}:
7
8rustPlatform.buildRustPackage rec {
9 pname = "planus";
10 version = "0.4.0";
11
12 src = fetchCrate {
13 pname = "planus-cli";
14 inherit version;
15 hash = "sha256-KpX4KSA2MjfRS8M0WVYpY4hoSvOOB7MUz7YKZwEGqj8=";
16 };
17
18 cargoHash = "sha256-yT/ZK5GG0rXpiaCQlQclK2iY8BXhhmiW/UDX9aL8wBQ=";
19
20 nativeBuildInputs = [
21 installShellFiles
22 ];
23
24 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
25 installShellCompletion --cmd planus \
26 --bash <($out/bin/planus generate-completions bash) \
27 --fish <($out/bin/planus generate-completions fish) \
28 --zsh <($out/bin/planus generate-completions zsh)
29 '';
30
31 meta = with lib; {
32 description = "An alternative compiler for flatbuffers";
33 homepage = "https://github.com/planus-org/planus";
34 changelog = "https://github.com/planus-org/planus/blob/v${version}/CHANGELOG.md";
35 license = with licenses; [ asl20 mit ];
36 maintainers = with maintainers; [ figsoda ];
37 };
38}