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

61 lines
1.5 KiB
Nix
Raw Permalink Normal View History

{
lib,
2025-02-13 19:23:48 +03:00
rust,
stdenv,
fetchFromGitHub,
rustPlatform,
installShellFiles,
2025-02-13 19:23:48 +03:00
cargo-c,
testers,
yara-x,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "yara-x";
2025-05-19 18:48:03 +00:00
version = "0.15.0";
src = fetchFromGitHub {
owner = "VirusTotal";
repo = "yara-x";
tag = "v${finalAttrs.version}";
2025-05-19 18:48:03 +00:00
hash = "sha256-fbuh/SMfOygnuvG9zTZqem4oLaS+5uXScXPhU3aVDjM=";
};
2025-05-19 18:48:03 +00:00
cargoHash = "sha256-+dPIujaxDJ7JrtNvX4VjGHFmgtCb1BJpFQL4c3E1/GY=";
nativeBuildInputs = [
installShellFiles
2025-02-13 19:23:48 +03:00
cargo-c
];
2025-02-13 19:23:48 +03:00
postBuild = ''
${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
'';
2025-02-13 19:23:48 +03:00
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;
};
meta = {
description = "Tool to do pattern matching for malware research";
homepage = "https://virustotal.github.io/yara-x/";
changelog = "https://github.com/VirusTotal/yara-x/releases/tag/v${finalAttrs.version}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [
fab
lesuisse
];
mainProgram = "yr";
};
})