5 months ago
I have a monorepo setup using nixpacks where I want to build & deploy multiple services from the same repository.
My backend service (bun, elysia, prisma) needs dependencies on openssl. That's why included a custom nixpacks.toml config in the repo (/root path) to be picked up during build:
providers = ["...", "python"]
# use latest bun
[phases.setup]
nixpkgsArchive = 'master'
[phases.build]
nixLibs = ['openssl']
However, when I'm now building my frontend app, I get errors:
Build failed with 1 error
[stage-0 10/15] RUN --mount=type=cache,id=s/2eaef31b-cf6f-4894-8c52-c500f3c266af-/root/bun,target=/root/.bun npm install -g corepack@0.24.1 && corepack enable
"npm install -g corepack@0.24.1 && corepack enable" did not complete successfully: exit code: 1
View in context
/nix/store/7l1wra7b87yci5dln0hm0k8rwww6f2xj-nodejs-22.14.0/bin/node: /nix/store/2kl52k9kclb82bg8nvf4paxb3v972c70-openssl-3.0.10/lib/libcrypto.so.3: version `OPENSSL_3.4.0' not found (required by /nix/store/7l1wra7b87yci5dln0hm0k8rwww6f2xj-nodejs-22.14.0/bin/node)
/nix/store/7l1wra7b87yci5dln0hm0k8rwww6f2xj-nodejs-22.14.0/bin/node: /nix/store/s94fwp43xhzkvw8l8nqslskib99yifzi-gcc-13.3.0-lib/lib/libstdc++.so.6: version `CXXABI_1.3.15' not found (required by /nix/store/jbnm36wq89c7iws6xx6xvv75h0drv48x-icu4c-76.1/lib/libicui18n.so.76)
How to setup different nixpacks configs per service in this monorepo?
8 Replies
5 months ago
Hi, please can you set up different nixpack config for each service within the monorepo?
In each service on Railway , specify a different root directory and ensure each service has its own nixpacks.toml config.
Status changed to Awaiting User Response Railway • 5 months ago
5 months ago
Hi, thanks for your response.
I'm currently building from the same root for every service (using turborepo).
Providing a custom nixpacks config is only possible by providing nixpacks.[toml|json]
in the root of the project?
For customizing the railway config I have provided 2 files railway-frontend.json
and railway-backend.json
since it is possible to define different config path for railway config for each service.
Status changed to Awaiting Railway Response Railway • 5 months ago
5 months ago
Alright, gotcha!
Status changed to Awaiting User Response Railway • 5 months ago
5 months ago
Now, is it possible to provide a per service nixpacks config?
Status changed to Awaiting Railway Response Railway • 5 months ago
5 months ago
Yes, you have to set up different root directories for each service. Each of the root directories will then have a nixpacks.toml or nixpacks.json file. You can now specify the root directory for each service in the service settings.
Status changed to Awaiting User Response Railway • 5 months ago
5 months ago
Or if you want to just deploy from root with two differently named config files, you can set the correct config file in the service settings, all the way at the bottom.
brody
Or if you want to just deploy from root with two differently named config files, you can set the correct config file in the service settings, all the way at the bottom.
5 months ago
This setting is only for the railway config, right? Not the Nixpacks config...
Status changed to Awaiting Railway Response Railway • 5 months ago
psoudan
This setting is only for the railway config, right? Not the Nixpacks config...
5 months ago
yes
Status changed to Awaiting User Response Railway • 5 months ago
Status changed to Solved brody • 5 months ago