Migrating to nixpacks on a monorepo with multiple services

Hey, I'm currently trying to migrate to nixpacks due to the deprecation of Heroku buildpacks, but I'm finding the migration as smooth as hoped. I have a fairly standard Go monorepo with the classic cmd, pkg folders and what not. In the cmd I have multiple services, each deployed to railway as a separate service. I managed to eventually migrate each individual one to nixpacks by overriding the build command to something like: go build -o bin/bot ./cmd/bot. However, I'd like to specify these commands in a configuration file so it's not hardcoded in the railway dashboard. I've found that you have some documentation on how to do this through the nixpacks.toml file, or through the environment variables such as NIXPACKS_BUILD_CMD. I haven't really found in the documentation how to leverage the configuration files for a monorepo with multiple services. Do you have any resources around this?
Configuring Builds | Nixpacks
App source + Nix packages + Docker = Image
6 Replies
Percy
Percy3y ago
Project ID: 4422bada-2d1e-4333-b644-ccf8d3033e95
manzanit0
manzanit0OP3y ago
4422bada-2d1e-4333-b644-ccf8d3033e95
Percy
Percy3y ago
Flagging this thread. A team member will be with you shortly.
jr
jr3y ago
Hey @manzanit0, Just to confirm my understanding, you want to codify the build command in the the repo? That is doable in a few ways. The best is to probably join our beta program and use Railway config as code. This allows you to specify various service settings in code. You can specify the config file location per service https://docs.railway.app/deploy/config-as-code
manzanit0
manzanit0OP3y ago
Gotcha. And the location of the file doesn't matter because you would specify it through the Railway UI. Nice one; just gave it a shot. That was exactly what I needed! Is there any convention Railway expects which would help me not need to specify the file location in the UI?
jr
jr3y ago
By default we will look for a railway.toml or railway.json in the root directory
Want results from more Discord servers?
Add your server