2024-02-10 13:58:58 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "leetgo";
|
2024-11-08 13:01:41 +00:00
|
|
|
version = "1.4.10";
|
2024-02-10 13:58:58 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "j178";
|
|
|
|
repo = "leetgo";
|
|
|
|
rev = "v${version}";
|
2024-11-08 13:01:41 +00:00
|
|
|
hash = "sha256-0cBhJfxzzZ5IrVVYNWVoKK9c1baj5U2CvDO52wdsjcs=";
|
2024-02-10 13:58:58 +00:00
|
|
|
};
|
|
|
|
|
2024-11-08 13:01:41 +00:00
|
|
|
vendorHash = "sha256-1/U+sPauV3kYvQKTGSuX9FvvEFNsksTPXtfZH0a/o0s=";
|
2024-02-10 13:58:58 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X=github.com/j178/leetgo/constants.Version=${version}"
|
|
|
|
];
|
|
|
|
|
|
|
|
subPackages = [ "." ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd leetgo \
|
|
|
|
--bash <($out/bin/leetgo completion bash) \
|
|
|
|
--fish <($out/bin/leetgo completion fish) \
|
|
|
|
--zsh <($out/bin/leetgo completion zsh)
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A command-line tool for LeetCode";
|
|
|
|
homepage = "https://github.com/j178/leetgo";
|
|
|
|
changelog = "https://github.com/j178/leetgo/releases/tag/v${version}";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ Ligthiago ];
|
|
|
|
mainProgram = "leetgo";
|
|
|
|
};
|
|
|
|
}
|