-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unable to use spago bundle-app in nix derivation since 0.20.8 #888
Comments
Thanks for reporting @yuanwang-wf! This is a bug, and I suspect it's due to us changing the way we invoke programs. |
hey @f-f, thank you for looking into it. I am afraid the nix log from https://github.com/yuanw/blog/blob/master/purescript/default.nix#L20
let me know if there any additional information i can provide |
I found this issue after filing justinwoo/spago2nix#52. Not sure if they're related. @yuanwang-wf you can get past that error by setting |
@yuanwang-wf sorry, I misread, setting
|
Could there be a regression with the In justinwoo/spago2nix#52 I'm trying to run After upgrading to |
i guess this correct workaround is frontendJs = pkgs.stdenv.mkDerivation {
name = "frontendJs";
buildInputs = [ spagoPkgs.installSpagoStyle spagoPkgs.buildSpagoStyle ];
nativeBuildInputs = with pkgs; [ purs spago esbuild ];
src = ./.;
unpackPhase = ''
cp $src/spago.dhall .
cp $src/packages.dhall .
cp -r $src/src .
install-spago-style
'';
# https://github.com/purescript/spago/blob/310a7096b0d3e86f6464c667aa2339045d85d505/src/Spago/Build.hs#L422
# https://esbuild.github.io/api/#transform-api
buildPhase = ''
build-spago-style "./src/**/*.purs"
echo 'import {main} from "./output/Main/index.js"; main();' | esbuild --platform=browser --format=iife --bundle --outfile="frontend.js"
'';
installPhase = ''
mkdir $out
mv frontend.js $out/
'';
}; we need echo esbuild transform-api to invoke main method. i think the issue caused from here Line 279 in 678e004
do we have to use |
@yuanwang-wf we used to have a mix of |
thanks for the confirmation , i can give a try |
hey @f-f patching this is the patching diff and i pulled this patched spago in another nix flake repo with this patched spago, i was able to bundle the js in a nix derivation locally (had to pull git as build input) i verified there is no difference between the spago bundle results and direct esbuild bundle result in this repo. is there anything else i can help with ? i am not sure how to fix the issue: introduce a new command line flag ? or invoke Turtle.shell in no-install mode ? |
Can you open a pull request with the patch? So that we can have CI run for all OSs and we can see if there are any regressions anywhere |
I approved the workflow and CI passes so I think the patch is good - I now wonder if we're able to write a test that fails with the current code but passes with the patch? |
since the failure was due to a failure on |
Spago was rewritten in PureScript so I expect that the nix machinery will be very different this time around - closing for now |
before spago 0.20.8. One can bundle a purescript app using spago2nix and spago in a nix derivation
Referece
https://discourse.purescript.org/t/spago2nix-any-complete-example-to-look-at/2532/4
But with spago 0.20.8 or later. It seems
build
andbundle-app
is kicking out a process which doesn't work in a nix (flake) derivationI wonder is possible to get
bundle-app
work in a derivation ?one workaround is using esbuild directly
Referece:
https://github.com/yuanw/blog/blob/2f1b50df9c301b56fba300b0d24e97dc2a62634b/purescript/default.nix#L19
The text was updated successfully, but these errors were encountered: