aboutsummaryrefslogtreecommitdiffhomepage
path: root/flake.nix
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2023-10-15 15:46:09 +0200
committerRon Evans <[email protected]>2023-10-15 17:51:13 +0200
commit4d4ccddad8ebb1be5246ec889f1ce3a9b9cf9e9e (patch)
tree73106601a5d285b8b38fb68592ca573f783b74f3 /flake.nix
parentf55f5315ccc547cfa32bc7c39392c90c3eb2ea97 (diff)
downloadtinygo-4d4ccddad8ebb1be5246ec889f1ce3a9b9cf9e9e.tar.gz
tinygo-4d4ccddad8ebb1be5246ec889f1ce3a9b9cf9e9e.zip
nix: support `make wasi-libc` on MacOS
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix12
1 files changed, 9 insertions, 3 deletions
diff --git a/flake.nix b/flake.nix
index 60cb579b2..30e5cde1d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -64,10 +64,16 @@
#openocd
];
shellHook= ''
+ # Configure CLANG, LLVM_AR, and LLVM_NM for `make wasi-libc`.
+ # Without setting these explicitly, Homebrew versions might be used
+ # or the default `ar` and `nm` tools might be used (which don't
+ # support wasi).
+ export CLANG="clang-16 -resource-dir ${llvmPackages_16.clang.cc.lib}/lib/clang/16"
+ export LLVM_AR=llvm-ar
+ export LLVM_NM=llvm-nm
+
# Ugly hack to make the Clang resources directory available.
- # Perhaps there is a cleaner way to do it, but this works.
- export CLANG_RESOURCE_DIR="${llvmPackages_16.clang.cc.lib}/lib/clang/16"
- export GOFLAGS="\"-ldflags=-X github.com/tinygo-org/tinygo/goenv.clangResourceDir=$CLANG_RESOURCE_DIR"\"
+ export GOFLAGS="\"-ldflags=-X github.com/tinygo-org/tinygo/goenv.clangResourceDir=${llvmPackages_16.clang.cc.lib}/lib/clang/16"\"
'';
};
}