1{ lib
2, rustPlatform
3, fetchCrate
4, fetchpatch
5, stdenv
6, darwin
7}:
8
9rustPlatform.buildRustPackage rec {
10 pname = "hvm";
11 version = "1.0.9";
12
13 src = fetchCrate {
14 inherit pname version;
15 hash = "sha256-dO0GzbMopX84AKOtJYYW6vojcs4kYcZ8LQ4tXEgUN7I=";
16 };
17
18 cargoHash = "sha256-RQnyVRHWrqnKcI3Jy593jDTydG1nGyrScsqSNyJTDJk=";
19
20 patches = [
21 # see https://github.com/higherorderco/hvm/pull/220
22 # this commit removes the feature to fix build with rust nightly
23 # but this feature is required with rust stable
24 (fetchpatch {
25 name = "revert-fix-remove-feature-automic-mut-ptr.patch";
26 url = "https://github.com/higherorderco/hvm/commit/c0e35c79b4e31c266ad33beadc397c428e4090ee.patch";
27 hash = "sha256-9xxu7NOtz3Tuzf5F0Mi4rw45Xnyh7h9hbTrzq4yfslg=";
28 revert = true;
29 })
30 ];
31
32 buildInputs = lib.optionals stdenv.isDarwin [
33 darwin.apple_sdk_11_0.frameworks.IOKit
34 ];
35
36 # tests are broken
37 doCheck = false;
38
39 # enable nightly features
40 RUSTC_BOOTSTRAP = true;
41
42 meta = with lib; {
43 description = "A pure functional compile target that is lazy, non-garbage-collected, and parallel";
44 homepage = "https://github.com/higherorderco/hvm";
45 license = licenses.mit;
46 maintainers = with maintainers; [ figsoda ];
47 };
48}