nixpkgs/pkgs/by-name/cy/cyme/package.nix
2025-05-30 07:22:31 +00:00

70 lines
1.7 KiB
Nix

{
lib,
fetchFromGitHub,
rustPlatform,
pkg-config,
installShellFiles,
stdenv,
darwin,
versionCheckHook,
nix-update-script,
}:
rustPlatform.buildRustPackage rec {
pname = "cyme";
version = "2.2.2";
src = fetchFromGitHub {
owner = "tuna-f1sh";
repo = "cyme";
rev = "v${version}";
hash = "sha256-oOr7LYQfA/ZtC1Up4/dAHFdtWAM+8J+OPiHIOtVLQxY=";
};
useFetchCargoVendor = true;
cargoHash = "sha256-PaX2Eod/5eCZFzMzkLovhE/TpQqNyhqCHaF1LiRxndg=";
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";
};
}