-
Notifications
You must be signed in to change notification settings - Fork 8
/
default.nix
82 lines (69 loc) · 2.19 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{ rev ? "652af6eb88e1bc633bc6dc44827519f6e7284dbb" # release-23.05
, sha256 ? "sha256:0hi1a2yjkb2ljbq3jb35rqh5h3zdjmdx2vdg91g8fa5hxf7wzz70"
, pkgs ?
if builtins.compareVersions builtins.nixVersion "2.0" < 0
then abort "winter requires at least nix 2.0"
else import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
inherit sha256;
}) {
config.allowUnfree = true;
config.allowBroken = false;
}
, returnShellEnv ? pkgs.lib.inNixShell
}:
let
spec-tests = pkgs.fetchFromGitHub {
owner = "WebAssembly";
repo = "testsuite";
rev = "35c50bf6fbb002cfdc1227b0af731bdcaf877714";
sha256 = "0difcpya5i7fc4xdrysx49186x9vh5yhm88dqpmfppj7ddj39l9i";
};
haskellPackages = pkgs.haskellPackages;
# wabt >= 1.0.25 (until at least 1.0.32) cause winter's test suite to fail on
# the line: https://github.com/WebAssembly/testsuite/blob/35c50bf6fbb002cfdc1227b0af731bdcaf877714/elem.wast#L15
# with the error:
#
# line 4
# user error (./test1296-222.wat:13:4: error: redefinition of elem "$t"
# (elem $t (i32.const 0) $f $f)
# ^^^^
# ./test1296-222.wat:14:4: error: redefinition of elem "$t"
# (elem $t (offset (i32.const 0)))
# ^^^^
# ./test1296-222.wat:15:4: error: redefinition of elem "$t"
# (elem $t (offset (i32.const 0)) $f $f)
# ^^^^
# )
#
# So we keep wabt at 1.0.24:
wabt = pkgs.wabt.overrideAttrs (_old: rec {
name = "wabt-${version}";
version = "1.0.24";
src = pkgs.fetchFromGitHub {
owner = "WebAssembly";
repo = "wabt";
rev = version;
sha256 = "sha256-/blukivL6+xsnChxDp5gCr5w8S3bBuhO459YkLGxYmA=";
fetchSubmodules = true;
};
});
drv = haskellPackages.developPackage {
name = "winter";
root = ./.;
overrides = with pkgs.haskell.lib; self: super: {
};
source-overrides = {};
modifier = drv: pkgs.haskell.lib.overrideCabal drv (attrs: {
buildTools = (attrs.buildTools or []) ++ [
wabt
pkgs.cabal-install
haskellPackages.haskell-language-server
];
passthru = {
nixpkgs = pkgs;
};
});
inherit returnShellEnv;
};
in drv.overrideAttrs(old: { WASM_SPEC_TESTS = "${spec-tests}"; })