about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/solo2-cli/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/solo2-cli/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/solo2-cli/default.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/security/solo2-cli/default.nix b/nixpkgs/pkgs/tools/security/solo2-cli/default.nix
new file mode 100644
index 000000000000..eaa2bc659a56
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/solo2-cli/default.nix
@@ -0,0 +1,49 @@
+{ lib
+, stdenv
+, rustPlatform
+, fetchFromGitHub
+, installShellFiles
+, pkg-config
+, pcsclite
+, udev
+, PCSC
+, IOKit
+, CoreFoundation
+, AppKit
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "solo2-cli";
+  version = "0.1.1";
+
+  src = fetchFromGitHub {
+    owner = "solokeys";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-3GIK0boxGD4Xa5OskP1535zCQyhMQ/oXbgThRivJzww=";
+  };
+
+  cargoSha256 = "sha256-MYxVegXUVeZ4AzDz+Si5TtTjUDEPTO0Nh008rgLtsLw=";
+
+  nativeBuildInputs = [ installShellFiles pkg-config ];
+
+  buildInputs = [ ]
+    ++ lib.optionals stdenv.isLinux [ pcsclite udev ]
+    ++ lib.optionals stdenv.isDarwin [ PCSC IOKit CoreFoundation AppKit ];
+
+  postInstall = ''
+    install -D 70-solo2.rules $out/lib/udev/rules.d/70-solo2.rules
+    installShellCompletion target/*/release/solo2.{bash,fish,zsh}
+  '';
+
+  doCheck = true;
+
+  buildFeatures = [ "cli" ];
+
+  meta = with lib; {
+    description = "A CLI tool for managing SoloKeys' Solo2 USB security keys.";
+    homepage = "https://github.com/solokeys/solo2-cli";
+    license = with licenses; [ asl20 mit ]; # either at your option
+    maintainers = with maintainers; [ lukegb ];
+  };
+}