1{ lib
2, stdenv
3, rustPlatform
4, fetchFromGitHub
5, installShellFiles
6, pkg-config
7, pcsclite
8, udev
9, PCSC
10, IOKit
11, CoreFoundation
12, AppKit
13}:
14
15rustPlatform.buildRustPackage rec {
16 pname = "solo2-cli";
17 version = "0.2.2";
18
19 src = fetchFromGitHub {
20 owner = "solokeys";
21 repo = pname;
22 rev = "v${version}";
23 sha256 = "sha256-7tpO5ir42mIKJXD0NJzEPXi/Xe6LdyEeBQWNfOdgX5I=";
24 };
25
26 cargoHash = "sha256-X+IEeztSL312Yq9Loi3cNJuVfSGk/tRRBCsy0Juji7Y=";
27
28 nativeBuildInputs = [ installShellFiles pkg-config ];
29
30 buildInputs = [ ]
31 ++ lib.optionals stdenv.isLinux [ pcsclite udev ]
32 ++ lib.optionals stdenv.isDarwin [ PCSC IOKit CoreFoundation AppKit ];
33
34 postInstall = ''
35 install -D 70-solo2.rules $out/lib/udev/rules.d/70-solo2.rules
36 installShellCompletion target/*/release/solo2.{bash,fish,zsh}
37 '';
38
39 doCheck = true;
40
41 buildFeatures = [ "cli" ];
42
43 meta = with lib; {
44 description = "A CLI tool for managing SoloKeys' Solo2 USB security keys.";
45 homepage = "https://github.com/solokeys/solo2-cli";
46 license = with licenses; [ asl20 mit ]; # either at your option
47 maintainers = with maintainers; [ lukegb ];
48 mainProgram = "solo2";
49 };
50}