Closed alissa-tung closed 9 months ago
I had tried to run something like
patchPhase = ''
sed -i "s|next build|pnpm exec buf generate \${x-proto}/x.proto \&\& ls lib/gen/x/v1 \&\& next build|g" ./package.json
cat ./package.json | grep 'build'
'';
the logs said the grep is okay, but the buf generate does not create dir
Running phase: buildPhase
> x@0.1.0 build /build/x
> pnpm exec buf generate /nix/store/a-x-proto-0.0.0/x.proto && ls lib/gen/x/v1 && next build
ls: cannot access 'lib/gen/x/v1': No such file or directory
ELIFECYCLE Command failed with exit code 2.
turns out buf generate is my problem, that is, buf generate accepts a path x/y/z
, where the output path structure is relative
I had tried to make a drv FOD to access to the network
mkPnpmPackage {
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "";
}
but seems that Nix still does not allow this drv to access network. 🤔
I do not know of any way to convince nextjs do use a pre-downloaded font when using the google fonts package (haven't used it personally yet). You can of course use a local font instead and supply the font files either through pnpm or through nix.
As for the codegen: Instead of patching the package.json, I recommend you use preBuild
instead. That should run as the first thing in the buildPhase
and you can just run pnpm exec buf generate ...
in there
Thank you. I am still trying to find out why the above FOD does not work and node said UNABLE_TO_GET_ISSUER_CERT_LOCALLY
but all of them are not quite relevant to this project's scope. Anyway thank you for developing this project. If someone sees this issue, I would like to tell this may be the only usable pnpm2nix like project, and it does can package pnpm packages.
your project are great! thank you for developing a nice and well documented tool for pnpm & nix.
hello, I am trying to build an application using next.js packages and connectrpc. I am not sure whether my problems are related to this project's scope. If not please feel free to close this issue
my questions are
how can I run some custom scripts to generate some code? like thejust patch the build scriptspnpm exec buf generate a.proto
? the issue is difficult is becausepnpm exec buf generate
needs the devDeps in package.json is installed by pnpm. I had tried to sed to modify the package.json the build field. but seems that does not work