1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 testers,
6 wizer,
7}:
8
9rustPlatform.buildRustPackage rec {
10 pname = "wizer";
11 version = "9.0.0";
12
13 # the crate does not contain files which are necessary for the tests
14 # see https://github.com/bytecodealliance/wizer/commit/3a95e27ce42f1fdaef07b52988e4699eaa221e04
15 src = fetchFromGitHub {
16 owner = "bytecodealliance";
17 repo = "wizer";
18 tag = "v${version}";
19 hash = "sha256-q7v5LH3dp7qtgQJ3Ovt0fPP5r82cHghX6925TLfmn3o=";
20 };
21
22 cargoHash = "sha256-5P8rkwKAVPEJnpk6M7lH6hBOPV1q4+aIghJBbjas4fE=";
23
24 cargoBuildFlags = [
25 "--bin"
26 pname
27 ];
28
29 buildFeatures = [
30 "env_logger"
31 "structopt"
32 ];
33
34 # Setting $HOME to a temporary directory is necessary to prevent checks from failing, as
35 # the test suite creates a cache directory at $HOME/Library/Caches/BytecodeAlliance.wasmtime.
36 preCheck = ''
37 export HOME=$(mktemp -d)
38 '';
39
40 passthru.tests = {
41 version = testers.testVersion { package = wizer; };
42 };
43
44 meta = with lib; {
45 description = "WebAssembly pre-initializer";
46 mainProgram = "wizer";
47 homepage = "https://github.com/bytecodealliance/wizer";
48 license = licenses.asl20;
49 maintainers = with maintainers; [
50 lucperkins
51 amesgen
52 ];
53 };
54}