nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 76 lines 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 rustPlatform, 5 fetchFromGitHub, 6 installShellFiles, 7 makeWrapper, 8 pkg-config, 9 openssl, 10 maa-assistant-arknights, 11 android-tools, 12 git, 13}: 14 15rustPlatform.buildRustPackage rec { 16 pname = "maa-cli"; 17 version = "0.5.9"; 18 19 src = fetchFromGitHub { 20 owner = "MaaAssistantArknights"; 21 repo = "maa-cli"; 22 rev = "v${version}"; 23 hash = "sha256-TLm8B1cQ00l9aRADYU3Qv7nA04kDaxsXX86qvsTRWwk="; 24 }; 25 26 nativeBuildInputs = [ 27 installShellFiles 28 makeWrapper 29 pkg-config 30 ]; 31 32 buildInputs = [ openssl ]; 33 34 # https://github.com/MaaAssistantArknights/maa-cli/pull/126 35 buildNoDefaultFeatures = true; 36 buildFeatures = [ "git2" ]; 37 38 cargoHash = "sha256-pJlTcxF6nzV4HfMTs/gAzSUubDy2UlhzEIVeSWs6uX0="; 39 40 # maa-cli would only search libMaaCore.so and resources in itself's path 41 # https://github.com/MaaAssistantArknights/maa-cli/issues/67 42 postInstall = '' 43 mkdir -p $out/share/maa-assistant-arknights/ 44 ln -s ${maa-assistant-arknights}/share/maa-assistant-arknights/* $out/share/maa-assistant-arknights/ 45 ln -s ${maa-assistant-arknights}/lib/* $out/share/maa-assistant-arknights/ 46 mv $out/bin/maa $out/share/maa-assistant-arknights/ 47 48 makeWrapper $out/share/maa-assistant-arknights/maa $out/bin/maa \ 49 --prefix PATH : "${ 50 lib.makeBinPath [ 51 android-tools 52 git 53 ] 54 }" 55 56 '' 57 + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 58 installShellCompletion --cmd maa \ 59 --bash <($out/bin/maa complete bash) \ 60 --fish <($out/bin/maa complete fish) \ 61 --zsh <($out/bin/maa complete zsh) 62 63 mkdir -p manpage 64 $out/bin/maa mangen --path manpage 65 installManPage manpage/* 66 ''; 67 68 meta = { 69 description = "Simple CLI for MAA by Rust"; 70 homepage = "https://github.com/MaaAssistantArknights/maa-cli"; 71 license = lib.licenses.agpl3Only; 72 platforms = lib.platforms.linux ++ lib.platforms.darwin; 73 maintainers = with lib.maintainers; [ Cryolitia ]; 74 mainProgram = "maa"; 75 }; 76}