2024-06-05 15:53:02 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, installShellFiles, rustPlatform, Security }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "jwt-cli";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "6.1.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mike-engel";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2024-09-19 14:19:46 +00:00
|
|
|
sha256 = "sha256-v6wy3+j351TZUasj7WvJwCDoqXRIcJutmNZLvwGcwBE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
cargoHash = "sha256-o9W1yMsTwByAiKiiY4Dx+RxOpvNuGlW7pqFB1pxVYZo=";
|
2024-06-05 15:53:02 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
buildInputs = lib.optional stdenv.isDarwin Security;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
2024-06-05 15:53:02 +00:00
|
|
|
installShellCompletion --cmd jwt \
|
|
|
|
--bash <($out/bin/jwt completion bash) \
|
|
|
|
--fish <($out/bin/jwt completion fish) \
|
|
|
|
--zsh <($out/bin/jwt completion zsh)
|
|
|
|
'';
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
doInstallCheck = true;
|
2021-12-06 16:07:01 +00:00
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/jwt --version > /dev/null
|
|
|
|
$out/bin/jwt decode eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c \
|
|
|
|
| grep -q 'John Doe'
|
|
|
|
'';
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
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 ];
|
2022-04-27 09:35:20 +00:00
|
|
|
mainProgram = "jwt";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|