Got the build working

This commit is contained in:
StealthBadger747
2025-07-15 11:43:55 -07:00
committed by Aarnav Tale
parent 51a85e1bfe
commit 7a34a01dd0
+19
View File
@@ -5,8 +5,17 @@
nodejs_22, nodejs_22,
pnpm_10, pnpm_10,
stdenv, stdenv,
go,
... ...
}: }:
let
wasmExecJs =
if builtins.pathExists "${go}/share/go/lib/wasm/wasm_exec.js"
then "${go}/share/go/lib/wasm/wasm_exec.js"
else if builtins.pathExists "${go}/lib/wasm/wasm_exec.js"
then "${go}/lib/wasm/wasm_exec.js"
else "${go}/share/go/misc/wasm/wasm_exec.js";
in
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "headplane"; pname = "headplane";
version = (builtins.fromJSON (builtins.readFile ../package.json)).version; version = (builtins.fromJSON (builtins.readFile ../package.json)).version;
@@ -17,6 +26,7 @@ stdenv.mkDerivation (finalAttrs: {
nodejs_22 nodejs_22
pnpm_10.configHook pnpm_10.configHook
git git
go
]; ];
dontCheckForBrokenSymlinks = true; dontCheckForBrokenSymlinks = true;
@@ -28,6 +38,15 @@ stdenv.mkDerivation (finalAttrs: {
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
# Build the Go WASM binary
export GOOS=js
export GOARCH=wasm
go build -o app/hp_ssh.wasm ./cmd/hp_ssh
# Copy wasm_exec.js to the app directory (from Nix store)
cp ${wasmExecJs} app/wasm_exec.js
pnpm build pnpm build
runHook postBuild runHook postBuild
''; '';