about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/jwt-cli/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/jwt-cli/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/jwt-cli/default.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/security/jwt-cli/default.nix b/nixpkgs/pkgs/tools/security/jwt-cli/default.nix
new file mode 100644
index 000000000000..77e5ce08913e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/jwt-cli/default.nix
@@ -0,0 +1,31 @@
+{ lib, stdenv, fetchFromGitHub, rustPlatform, Security, fetchpatch }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "jwt-cli";
+  version = "5.0.2";
+
+  src = fetchFromGitHub {
+    owner = "mike-engel";
+    repo = pname;
+    rev = version;
+    sha256 = "0w7fqmh8gihknvdamnq1n519253d4lxrpv378jajca9x906rqy1r";
+  };
+
+  cargoSha256 = "0b7m23azy8cb8d5wkawnw6nv8k7lfnfwc06swmbkfvg8vcxfsacs";
+
+  buildInputs = lib.optional stdenv.isDarwin Security;
+
+  doInstallCheck = true;
+  installCheckPhase = ''
+    $out/bin/jwt --version > /dev/null
+    $out/bin/jwt decode eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c \
+      | grep -q 'John Doe'
+  '';
+
+  meta = with lib; {
+    description = "Super fast CLI tool to decode and encode JWTs";
+    homepage = "https://github.com/mike-engel/jwt-cli";
+    license = with licenses; [ mit ];
+    maintainers = with maintainers; [ rycee ];
+  };
+}