nixpkgs/pkgs/by-name/ma/maa-cli/package.nix

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

73 lines
1.9 KiB
Nix
Raw Normal View History

2024-03-25 19:12:26 +00:00
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, installShellFiles
, makeWrapper
, pkg-config
, openssl
, maa-assistant-arknights
, android-tools
, git
}:
rustPlatform.buildRustPackage rec {
pname = "maa-cli";
2024-04-22 01:13:57 +00:00
version = "0.4.6";
2024-03-25 19:12:26 +00:00
src = fetchFromGitHub {
owner = "MaaAssistantArknights";
repo = "maa-cli";
rev = "v${version}";
2024-04-22 01:13:57 +00:00
hash = "sha256-fvMSYcYWYEVvDuAEjSmQJltl90EoLKkjYD2P3OsHS3c=";
2024-03-25 19:12:26 +00:00
};
nativeBuildInputs = [
installShellFiles
makeWrapper
pkg-config
];
buildInputs = [
openssl
];
# https://github.com/MaaAssistantArknights/maa-cli/pull/126
buildNoDefaultFeatures = true;
buildFeatures = [ "git2" "core_installer" ];
2024-04-22 01:13:57 +00:00
cargoHash = "sha256-LQWjgMRxtSs2MX1R6YsxDAWUvoUJfOWmp/zj/hlTxyw=";
2024-03-25 19:12:26 +00:00
# maa-cli would only seach libMaaCore.so and resources in itself's path
# https://github.com/MaaAssistantArknights/maa-cli/issues/67
postInstall = ''
mkdir -p $out/share/maa-assistant-arknights/
ln -s ${maa-assistant-arknights}/share/maa-assistant-arknights/* $out/share/maa-assistant-arknights/
ln -s ${maa-assistant-arknights}/lib/* $out/share/maa-assistant-arknights/
mv $out/bin/maa $out/share/maa-assistant-arknights/
makeWrapper $out/share/maa-assistant-arknights/maa $out/bin/maa \
--prefix PATH : "${lib.makeBinPath [
android-tools git
]}"
installShellCompletion --cmd maa \
--bash <($out/bin/maa complete bash) \
--fish <($out/bin/maa complete fish) \
--zsh <($out/bin/maa complete zsh)
2024-03-28 11:34:55 +00:00
mkdir -p manpage
$out/bin/maa mangen --path manpage
installManPage manpage/*
2024-03-25 19:12:26 +00:00
'';
meta = with lib; {
description = "A simple CLI for MAA by Rust";
homepage = "https://github.com/MaaAssistantArknights/maa-cli";
license = licenses.agpl3Only;
2024-03-25 19:12:26 +00:00
platforms = platforms.linux;
maintainers = with maintainers; [ Cryolitia ];
mainProgram = "maa";
};
}