mirror of
https://github.com/tale/headplane.git
synced 2026-08-20 09:52:19 +00:00
Maybe actually fix builds
This commit is contained in:
committed by
Aarnav Tale
parent
7a34a01dd0
commit
8b3d0e9bb6
@@ -29,7 +29,8 @@ rec {
|
|||||||
in rec {
|
in rec {
|
||||||
formatter = pkgs.alejandra;
|
formatter = pkgs.alejandra;
|
||||||
packages = {
|
packages = {
|
||||||
headplane = pkgs.callPackage ./nix/package.nix {};
|
hp_ssh_wasm = pkgs.callPackage ./nix/wasm.nix {};
|
||||||
|
headplane = pkgs.callPackage ./nix/package.nix { hp_ssh_wasm = packages.hp_ssh_wasm; };
|
||||||
headplane-agent = pkgs.callPackage ./nix/agent.nix {};
|
headplane-agent = pkgs.callPackage ./nix/agent.nix {};
|
||||||
};
|
};
|
||||||
checks.default = pkgs.symlinkJoin {
|
checks.default = pkgs.symlinkJoin {
|
||||||
@@ -61,7 +62,8 @@ rec {
|
|||||||
})
|
})
|
||||||
// {
|
// {
|
||||||
overlays.default = final: prev: {
|
overlays.default = final: prev: {
|
||||||
headplane = final.callPackage ./nix/package.nix {};
|
hp_ssh_wasm = final.callPackage ./nix/wasm.nix {};
|
||||||
|
headplane = final.callPackage ./nix/package.nix { hp_ssh_wasm = final.hp_ssh_wasm; };
|
||||||
headplane-agent = final.callPackage ./nix/agent.nix {};
|
headplane-agent = final.callPackage ./nix/agent.nix {};
|
||||||
};
|
};
|
||||||
nixosModules.headplane = import ./nix/module.nix;
|
nixosModules.headplane = import ./nix/module.nix;
|
||||||
|
|||||||
+14
-23
@@ -5,48 +5,38 @@
|
|||||||
nodejs_22,
|
nodejs_22,
|
||||||
pnpm_10,
|
pnpm_10,
|
||||||
stdenv,
|
stdenv,
|
||||||
go,
|
hp_ssh_wasm,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
wasmExecJs =
|
pkg = builtins.fromJSON (builtins.readFile ../package.json);
|
||||||
if builtins.pathExists "${go}/share/go/lib/wasm/wasm_exec.js"
|
pname = pkg.name;
|
||||||
then "${go}/share/go/lib/wasm/wasm_exec.js"
|
version = pkg.version;
|
||||||
else if builtins.pathExists "${go}/lib/wasm/wasm_exec.js"
|
src = ../.;
|
||||||
then "${go}/lib/wasm/wasm_exec.js"
|
|
||||||
else "${go}/share/go/misc/wasm/wasm_exec.js";
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "headplane";
|
pname = pname;
|
||||||
version = (builtins.fromJSON (builtins.readFile ../package.json)).version;
|
version = version;
|
||||||
src = ../.;
|
src = src;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
makeWrapper
|
makeWrapper
|
||||||
nodejs_22
|
nodejs_22
|
||||||
pnpm_10.configHook
|
pnpm_10.configHook
|
||||||
git
|
git
|
||||||
go
|
|
||||||
];
|
];
|
||||||
|
|
||||||
dontCheckForBrokenSymlinks = true;
|
dontCheckForBrokenSymlinks = true;
|
||||||
|
|
||||||
pnpmDeps = pnpm_10.fetchDeps {
|
pnpmDeps = pnpm_10.fetchDeps {
|
||||||
inherit (finalAttrs) pname version src;
|
inherit pname version src;
|
||||||
hash = "sha256-GNSpFqPobX6MDPUXxz2XwdZ2Wt7boN8aok52pGgpGoM=";
|
hash = "sha256-GNSpFqPobX6MDPUXxz2XwdZ2Wt7boN8aok52pGgpGoM=";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
|
cp ${hp_ssh_wasm}/hp_ssh.wasm app/hp_ssh.wasm
|
||||||
# Build the Go WASM binary
|
cp ${hp_ssh_wasm}/wasm_exec.js app/wasm_exec.js
|
||||||
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
|
||||||
'';
|
'';
|
||||||
@@ -55,10 +45,11 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
runHook preInstall
|
runHook preInstall
|
||||||
mkdir -p $out/{bin,share/headplane}
|
mkdir -p $out/{bin,share/headplane}
|
||||||
cp -r build $out/share/headplane/
|
cp -r build $out/share/headplane/
|
||||||
|
cp -r node_modules $out/share/headplane/
|
||||||
sed -i "s;$PWD;../..;" $out/share/headplane/build/server/index.js
|
sed -i "s;$PWD;../..;" $out/share/headplane/build/server/index.js
|
||||||
makeWrapper ${lib.getExe nodejs_22} $out/bin/headplane \
|
makeWrapper ${lib.getExe nodejs_22} $out/bin/headplane \
|
||||||
--chdir $out/share/headplane \
|
--chdir $out/share/headplane \
|
||||||
--add-flags $out/share/headplane/build/server/index.js
|
--add-flags $out/share/headplane/build/server/index.js
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{ buildGoModule, go, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
pkg = builtins.fromJSON (builtins.readFile ../package.json);
|
||||||
|
pname = "hp_ssh-wasm";
|
||||||
|
version = pkg.version;
|
||||||
|
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 rec {
|
||||||
|
inherit pname 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
|
||||||
|
'';
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user