-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathwasi-sdk.nix
48 lines (42 loc) · 1.36 KB
/
wasi-sdk.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
# Copied from https://github.com/ereslibre/nixities/blob/2c60af777fc863f90e6e4eeffcf3465def93a1f3/packages/wasi-sdk/default.nix
# with a fix for the autoPatchelfHook needing libstdc++.so and some refactor
{ lib, pkgs, stdenv }:
let
pname = "wasi-sdk";
version = "12";
in
pkgs.stdenv.mkDerivation {
inherit pname version;
sourceRoot = "${pname}-${version}.0";
dontBuild = true;
dontConfigure = true;
dontStrip = true;
nativeBuildInputs =
lib.optional stdenv.isLinux (with pkgs; [ autoPatchelfHook ]);
# Needed by autoPatchelfHook to have libstdc++
# see https://discourse.nixos.org/t/autopatchelfhook-not-patching-all-dependencies/14634/6
buildInputs =
lib.optional stdenv.isLinux [ stdenv.cc.cc.lib ];
installPhase = ''
mkdir -p $out/{bin,lib,share}
mv bin/* $out/bin/
mv lib/* $out/lib/
mv share/* $out/share/
'';
src =
let
tarball =
if stdenv.hostPlatform.isDarwin then {
suffix = "macos";
hash = "sha256-juJfnD/eYY/upcV62tOFFSYmeEtra1L7Vj5e2DK/U+8=";
} else {
suffix = "linux";
hash = "sha256-+kdpTXW/b86Y++eScZMpiyXuA9reJ/ykU9fdUwN4lzo=";
};
in
pkgs.fetchurl {
url =
"https://github.com/WebAssembly/${pname}/releases/download/${pname}-${version}/${pname}-${version}.0-${tarball.suffix}.tar.gz";
hash = tarball.hash;
};
}