3 months ago
Issue
Neither Nixpack nor Railpack detect that an application uses Bun
Context
I have a Turborepo monorepo where all applications use Node.js, except one (which uses Bun instead)
I don't have a build script for this application (sidenote: what's the right way to handle this? I'm running TS directly, so I'm just passing an echo for now)
My start script is
pnpm --filter @org/myapp run start
(which points tobun run src/index.ts
)I don't have a
bun.lockb
file (which might be the cue the builder is looking for?) because I'm using pnpm for package managementI do have a
bunfig.toml
file in the app root
I might have missed something in the docs! Thanks
5 Replies
3 months ago
Hello,
Yep, bun is picked up when there is a bun lock file, and only a bun lock file.
I don't know the syntax to add bun to Railpack yet, only the creator would at this time.
But you can add it to nixpacks with this nixpacks.toml file -
[phases.setup]
nixPkgs = ['...', 'bun']
Let me know if this works!
Best,
Brody
Status changed to Awaiting User Response railway[bot] • 3 months ago
brody
Hello,Yep, bun is picked up when there is a bun lock file, and only a bun lock file.I don't know the syntax to add bun to Railpack yet, only the creator would at this time.But you can add it to nixpacks with this nixpacks.toml file -[phases.setup] nixPkgs = ['...', 'bun']Let me know if this works!Best,Brody
3 months ago
Thanks! If I only want it installed during build for my bun application (and not for the node.js apps), this should be in the application's root, not the monorepo root - right? Is the recommended approach to use an environment variable in the bun service that points to the nixpacks.toml?
Also, any thoughts on installing via pre-deploy hook command for the service?
Status changed to Awaiting Railway Response railway[bot] • 3 months ago
3 months ago
Yep, you would likely want to store that file within a subdirectory and point to it with NIXPACKS_CONFIG_FILE
> any thoughts on installing via pre-deploy hook command for the service?
That wouldn't work, and it's not what it's designed for, the pre-deploy command is run in a separate container than the container that runs your application, so there is no shared file system.
Status changed to Awaiting User Response railway[bot] • 3 months ago
Status changed to Awaiting Railway Response railway[bot] • 3 months ago
3 months ago
Nixpacks doesn't even support the latest bun version unfortunately.
That kind of issue is why we needed to build a better builder -
Status changed to Awaiting User Response railway[bot] • 3 months ago