0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 14:10:33 +03:00
nixpkgs/pkgs/applications/misc/leetcode-cli/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.3 KiB
Nix
Raw Normal View History

2022-02-08 18:45:07 -05:00
{ lib
, fetchCrate
, rustPlatform
, pkg-config
2023-10-19 16:18:49 -07:00
, installShellFiles
2022-02-08 18:45:07 -05:00
, openssl
, dbus
, sqlite
, stdenv
, darwin
2023-08-14 12:50:34 +10:00
, testers
, leetcode-cli
2022-02-08 18:45:07 -05:00
}:
rustPlatform.buildRustPackage rec {
pname = "leetcode-cli";
2024-08-25 01:09:48 +00:00
version = "0.4.5";
2022-02-08 18:45:07 -05:00
src = fetchCrate {
inherit pname version;
2024-08-25 01:09:48 +00:00
hash = "sha256-Jc0akHj2DHbkF7sjslOwdeI1piW2gnhoalBz18lpQdQ=";
2022-02-08 18:45:07 -05:00
};
2024-08-25 01:09:48 +00:00
cargoHash = "sha256-t3u82bjO1Qv32TwpZNCaaEqOVajXIgM7VBNQ4UjMcl8=";
2022-02-08 18:45:07 -05:00
nativeBuildInputs = [
pkg-config
2023-10-19 16:18:49 -07:00
installShellFiles
2022-02-08 18:45:07 -05:00
];
buildInputs = [
openssl
dbus
sqlite
] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
2023-10-19 16:18:49 -07:00
installShellCompletion --cmd leetcode \
--bash <($out/bin/leetcode completions bash) \
--fish <($out/bin/leetcode completions fish) \
--zsh <($out/bin/leetcode completions zsh)
'';
2023-08-14 12:50:54 +10:00
passthru.tests = testers.testVersion {
package = leetcode-cli;
command = "leetcode -V";
version = "leetcode ${version}";
};
2022-02-08 18:45:07 -05:00
meta = with lib; {
description = "May the code be with you 👻";
longDescription = "Use leetcode.com in command line";
homepage = "https://github.com/clearloop/leetcode-cli";
license = licenses.mit;
maintainers = with maintainers; [ congee ];
mainProgram = "leetcode";
};
}