chore: tidy nix expressions
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
{
|
||||
rustPlatform,
|
||||
buildPackages,
|
||||
lld,
|
||||
name ? "wordle-solver",
|
||||
...
|
||||
}:
|
||||
rustPlatform.buildRustPackage {
|
||||
inherit name;
|
||||
|
||||
src = ../.; # Or your source location
|
||||
cargoLock.lockFile = ../Cargo.lock;
|
||||
|
||||
# Disable tests since they can't run on WASM
|
||||
doCheck = false;
|
||||
|
||||
# Required dependencies for WASM builds
|
||||
depsBuildBuild = [
|
||||
buildPackages.stdenv.cc
|
||||
lld # Needed for wasm-ld
|
||||
];
|
||||
|
||||
cargoBuildFlags = [
|
||||
"--lib"
|
||||
"--features"
|
||||
"wasm-bindgen"
|
||||
];
|
||||
|
||||
# Configure rustc for WASM
|
||||
env = {
|
||||
RUSTFLAGS = ''--cfg=web_sys_unstable_apis -C linker=wasm-ld'';
|
||||
};
|
||||
|
||||
# Copy the WASM file to the output
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib
|
||||
cp target/wasm32-unknown-unknown/release/*.wasm $out/lib/
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user