{ lib, fetchFromGitHub, rustPlatform, pkg-config, installShellFiles, stdenv, darwin, versionCheckHook, nix-update-script, }: rustPlatform.buildRustPackage rec { pname = "cyme"; version = "2.2.4"; src = fetchFromGitHub { owner = "tuna-f1sh"; repo = "cyme"; rev = "v${version}"; hash = "sha256-zwte2YzjEMW1wVti02tOa2IZMd2Z8amYUB9RHevx5bg="; }; cargoHash = "sha256-wOOcIkEgyR5Af78uMuCksalVH8VPFXptg232It/ilXE="; nativeBuildInputs = [ pkg-config installShellFiles ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.DarwinTools ]; checkFlags = [ # doctest that requires access outside sandbox "--skip=udev::hwdb::get" # - system_profiler is not available in the sandbox # - workaround for "Io Error: No such file or directory" "--skip=test_run" ]; postInstall = '' installManPage doc/cyme.1 installShellCompletion --cmd cyme \ --bash doc/cyme.bash \ --fish doc/cyme.fish \ --zsh doc/_cyme ''; nativeInstallCheckInputs = [ versionCheckHook ]; doInstallCheck = true; versionCheckProgram = "${placeholder "out"}/bin/${meta.mainProgram}"; versionCheckProgramArg = "--version"; passthru.updateScript = nix-update-script { }; meta = with lib; { homepage = "https://github.com/tuna-f1sh/cyme"; changelog = "https://github.com/tuna-f1sh/cyme/releases/tag/${src.rev}"; description = "Modern cross-platform lsusb"; license = licenses.gpl3Plus; maintainers = with maintainers; [ h7x4 ]; platforms = platforms.linux ++ platforms.darwin ++ platforms.windows; mainProgram = "cyme"; }; }