diff --git a/pkgs/by-name/ya/yara-x/package.nix b/pkgs/by-name/ya/yara-x/package.nix index 21a7691b670a..4d6766cb0b5d 100644 --- a/pkgs/by-name/ya/yara-x/package.nix +++ b/pkgs/by-name/ya/yara-x/package.nix @@ -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; };