1{ lib
2, stdenv
3, rustPlatform
4, fetchFromGitHub
5, testers
6, wizer
7}:
8
9rustPlatform.buildRustPackage rec {
10 pname = "wizer";
11 version = "3.0.1";
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 rev = "refs/tags/v${version}";
19 hash = "sha256-/4VkGvXlWU1jZztBCWCsJDQXTV8krIHaoyqmoXwjGIM=";
20 };
21
22 cargoHash = "sha256-M0EhyZH2maZCr4tWDo9ppKBM3CXEfwjUfnVksqVWKgU=";
23
24 cargoBuildFlags = [ "--bin" pname ];
25
26 buildFeatures = [ "env_logger" "structopt" ];
27
28 # Setting $HOME to a temporary directory is necessary to prevent checks from failing, as
29 # the test suite creates a cache directory at $HOME/Library/Caches/BytecodeAlliance.wasmtime.
30 preCheck = ''
31 export HOME=$(mktemp -d)
32 '';
33
34 passthru.tests = {
35 version = testers.testVersion { package = wizer; };
36 };
37
38 meta = with lib; {
39 description = "The WebAssembly pre-initializer";
40 homepage = "https://github.com/bytecodealliance/wizer";
41 license = licenses.asl20;
42 maintainers = with maintainers; [ lucperkins amesgen ];
43 };
44}