nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 rustPlatform,
5 pkg-config,
6 installShellFiles,
7 stdenv,
8 darwin,
9 versionCheckHook,
10 nix-update-script,
11}:
12
13rustPlatform.buildRustPackage rec {
14 pname = "cyme";
15 version = "2.2.3";
16
17 src = fetchFromGitHub {
18 owner = "tuna-f1sh";
19 repo = "cyme";
20 rev = "v${version}";
21 hash = "sha256-Zbb9CEsDtig9Nc6FUFZSdsfU7l6XHQvQK8asZ7O/Weo=";
22 };
23
24 cargoHash = "sha256-HdlhsOctPxOanbPAIJnlUoY4QeIluVsJlPglFXHBpFY=";
25
26 nativeBuildInputs = [
27 pkg-config
28 installShellFiles
29 ]
30 ++ lib.optionals stdenv.hostPlatform.isDarwin [
31 darwin.DarwinTools
32 ];
33
34 checkFlags = [
35 # doctest that requires access outside sandbox
36 "--skip=udev::hwdb::get"
37 # - system_profiler is not available in the sandbox
38 # - workaround for "Io Error: No such file or directory"
39 "--skip=test_run"
40 ];
41
42 postInstall = ''
43 installManPage doc/cyme.1
44 installShellCompletion --cmd cyme \
45 --bash doc/cyme.bash \
46 --fish doc/cyme.fish \
47 --zsh doc/_cyme
48 '';
49
50 nativeInstallCheckInputs = [
51 versionCheckHook
52 ];
53 doInstallCheck = true;
54 versionCheckProgram = "${placeholder "out"}/bin/${meta.mainProgram}";
55 versionCheckProgramArg = "--version";
56
57 passthru.updateScript = nix-update-script { };
58
59 meta = with lib; {
60 homepage = "https://github.com/tuna-f1sh/cyme";
61 changelog = "https://github.com/tuna-f1sh/cyme/releases/tag/${src.rev}";
62 description = "Modern cross-platform lsusb";
63 license = licenses.gpl3Plus;
64 maintainers = with maintainers; [ h7x4 ];
65 platforms = platforms.linux ++ platforms.darwin ++ platforms.windows;
66 mainProgram = "cyme";
67 };
68}