diff --git a/nix/packages/flake-module.nix b/nix/packages/flake-module.nix index bb4c599..dc48241 100755 --- a/nix/packages/flake-module.nix +++ b/nix/packages/flake-module.nix @@ -11,8 +11,9 @@ src = ../..; bunNix = ../../bun.nix; + dontFixup = true; - nativeBuildInputs = with pkgs; [ bun git ]; + nativeBuildInputs = with pkgs; [ bun git makeWrapper ]; buildPhase = '' runHook preBuild @@ -22,8 +23,6 @@ bun run build --bun bun build --compile --target=bun-linux-x64 --minify --outfile result ./.output/server/index.mjs - - echo "build completed with: $?" runHook postBuild ''; @@ -32,8 +31,12 @@ runHook preInstall mkdir -p $out/bin - mv result $out/bin/${pname} + install -p result $out/bin/${pname} cp -r ./.output/* $out + + # makeWrapper ${lib.getExe pkgs.bun} $out/bin/${pname} \ + # --chdir $out \ + # --append-flags "run start" runHook postInstall ''; diff --git a/temp.md b/temp.md new file mode 100755 index 0000000..4b1c963 --- /dev/null +++ b/temp.md @@ -0,0 +1,11 @@ +does anyone here have experience with packaging and running a js app derivation using bun? I believe I have all the individual pieces that I need to get this working, but I am struggling to tie them together, and knowing me it is just a super small thing that I'm missing. + +What I have so far +- solid start application +- build into a single file executable with `bun build --compile` (ran both locally and in the derivation's buildPhase) +- a flake with a package which is a bun2nix mkBunDerivation +- a machine that runs the package using `nix run url-to-flake` + +When I build and run the executable locally everything works as intended. +However when I use the package from the flake only bun's help text get printed. +Does anyone have any suggestions on what either the cause could be or how to debug this (I am very new to packaging in nix)