nixpkgs/pkgs/by-name/le/leetgo/package.nix
2024-08-11 13:43:05 +00:00

46 lines
1.0 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
}:
buildGoModule rec {
pname = "leetgo";
version = "1.4.8";
src = fetchFromGitHub {
owner = "j178";
repo = "leetgo";
rev = "v${version}";
hash = "sha256-4Y/NwgLNBdd2uL7oiIdM1I08ZnLjreHf397s/vhS+Ac=";
};
vendorHash = "sha256-zpS+6Z31m6g67we4JaQ0sPodqC315lgftqGzZkelDCU=";
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";
};
}