nixpkgs/pkgs/by-name/st/stripe-cli/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

79 lines
2.3 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, installShellFiles, stdenv }:
buildGoModule rec {
pname = "stripe-cli";
version = "1.21.10";
src = fetchFromGitHub {
owner = "stripe";
repo = pname;
rev = "v${version}";
hash = "sha256-L2ydkrm2foSIh67LsMYNvV53Hdj9TdV7C4tKeHe+AK0=";
};
vendorHash = "sha256-TuxYJ3u4/5PJYRoRgom+M1au9XerZ+vj9X3jUWTPM58=";
nativeBuildInputs = [ installShellFiles ];
ldflags = [
"-s"
"-w"
"-X github.com/stripe/stripe-cli/pkg/version.Version=${version}"
];
preCheck = ''
# the tests expect the Version ldflag not to be set
unset ldflags
# requires internet access
rm pkg/cmd/plugin_cmds_test.go
rm pkg/cmd/resources_test.go
rm pkg/cmd/root_test.go
# TODO: no clue why it's broken (1.17.1), remove for now.
rm pkg/login/client_login_test.go
rm pkg/git/editor_test.go
rm pkg/rpcservice/sample_create_test.go
'' + lib.optionalString (
# delete plugin tests on all platforms but exact matches
# https://github.com/stripe/stripe-cli/issues/850
! lib.lists.any
(platform: lib.meta.platformMatch stdenv.hostPlatform platform)
[ "x86_64-linux" "x86_64-darwin" ]
) ''
rm pkg/plugins/plugin_test.go
'';
postInstall = ''
installShellCompletion --cmd stripe \
--bash <($out/bin/stripe completion --write-to-stdout --shell bash) \
--zsh <($out/bin/stripe completion --write-to-stdout --shell zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/stripe --help
$out/bin/stripe --version | grep "${version}"
runHook postInstallCheck
'';
meta = with lib; {
homepage = "https://stripe.com/docs/stripe-cli";
changelog = "https://github.com/stripe/stripe-cli/releases/tag/v${version}";
description = "Command-line tool for Stripe";
longDescription = ''
The Stripe CLI helps you build, test, and manage your Stripe integration
right from the terminal.
With the CLI, you can:
Securely test webhooks without relying on 3rd party software
Trigger webhook events or resend events for easy testing
Tail your API request logs in real-time
Create, retrieve, update, or delete API objects.
'';
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ RaghavSood jk kashw2 ];
mainProgram = "stripe";
};
}