1{
2 stdenv,
3 lib,
4 buildGoModule,
5 buildPackages,
6 fetchFromGitHub,
7 installShellFiles,
8 nix-update-script,
9}:
10let
11 version = "0.0.46";
12in
13buildGoModule {
14
15 pname = "mcap-cli";
16
17 inherit version;
18
19 src = fetchFromGitHub {
20 repo = "mcap";
21 owner = "foxglove";
22 rev = "releases/mcap-cli/v${version}";
23 hash = "sha256-UdR5A2ZtCcnQIjPxlwcntZb78CXzJBvRy73GJUqvjuM=";
24 };
25
26 vendorHash = "sha256-ofJYarmnOHONu2lZ76GvSua0ViP1gr6968xAuQ/VRNk=";
27
28 nativeBuildInputs = [
29 installShellFiles
30 ];
31
32 modRoot = "go/cli/mcap";
33
34 env.GOWORK = "off";
35
36 # copy the local versions of the workspace modules
37 postConfigure = ''
38 chmod -R u+w vendor
39 rm -rf vendor/github.com/foxglove/mcap/go/{mcap,ros}
40 cp -r ../../{mcap,ros} vendor/github.com/foxglove/mcap/go
41 '';
42
43 checkFlags = [
44 # requires git-lfs and network
45 # https://github.com/foxglove/mcap/issues/895
46 "-skip=TestCat|TestInfo"
47 ];
48
49 postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
50 let
51 emulator = stdenv.hostPlatform.emulator buildPackages;
52 in
53 ''
54 installShellCompletion --cmd mcap \
55 --bash <(${emulator} $out/bin/mcap completion bash) \
56 --fish <(${emulator} $out/bin/mcap completion fish) \
57 --zsh <(${emulator} $out/bin/mcap completion zsh)
58 ''
59 );
60 passthru = {
61 updateScript = nix-update-script { };
62 };
63
64 meta = with lib; {
65 description = "MCAP CLI tool to inspect and fix MCAP files";
66 homepage = "https://github.com/foxglove/mcap";
67 license = with licenses; [ mit ];
68 maintainers = with maintainers; [
69 squalus
70 therishidesai
71 ];
72 mainProgram = "mcap";
73 };
74
75}