yara-x: build and install C library

This commit is contained in:
Roman Zakirzyanov 2025-02-13 19:23:48 +03:00
parent aa5c4e6328
commit 5030b60860

View File

@ -1,9 +1,11 @@
{
lib,
rust,
stdenv,
fetchFromGitHub,
rustPlatform,
installShellFiles,
cargo-c,
testers,
yara-x,
}:
@ -24,15 +26,24 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [
installShellFiles
cargo-c
];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd yr \
--bash <($out/bin/yr completion bash) \
--fish <($out/bin/yr completion fish) \
--zsh <($out/bin/yr completion zsh)
postBuild = ''
${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
'';
postInstall =
''
${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd yr \
--bash <($out/bin/yr completion bash) \
--fish <($out/bin/yr completion fish) \
--zsh <($out/bin/yr completion zsh)
'';
passthru.tests.version = testers.testVersion {
package = yara-x;
};