feat: nix: rename hp_ssh_wasm to headplane-ssh-wasm for consistency

This commit is contained in:
Igor Ramazanov 2025-07-27 02:19:45 +00:00 committed by Aarnav Tale
parent d257b22f91
commit 89e38e1356
3 changed files with 10 additions and 15 deletions

33
nix/ssh-wasm.nix Normal file
View file

@ -0,0 +1,33 @@
{
buildGoModule,
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
buildGoModule {
pname = "headplane-ssh-wasm";
version = (builtins.fromJSON (builtins.readFile ../package.json)).version;
src = ../.;
subPackages = ["cmd/hp_ssh"];
vendorHash = "sha256-3hZzDORAH+D4FW6SkOv3Enddd+q36ZALryvCPD9E5Ac=";
env.CGO_ENABLED = 0;
nativeBuildInputs = [go];
buildPhase = ''
export GOOS=js
export GOARCH=wasm
go build -o hp_ssh.wasm ./cmd/hp_ssh
'';
installPhase = ''
mkdir -p $out
cp hp_ssh.wasm $out/
cp ${wasmExecJs} $out/wasm_exec.js
'';
}