Install a binary during set up process

2 years ago

I'm trying to deploy a Node application that relies on a binary being available in the environment. I would like to avoid setting up a dockerfile if possible, they're a pain to deal with in monorepos.

I've tried setting it up through a nixpacks.toml file, but I'm not even sure it's being used

[phase.setup]
 nixPkgs = ['rustup']
 cmds = ['cargo install cryo_cli']
Closed

39 Replies

2 years ago

aa7cf7da-5a01-4af2-8db4-490ae195a3dc


2 years ago

but I'm not even sure it's being used

does the build table show you the commands youve set?


2 years ago

your syntax is slightly wrong too, here is the updated version -

[phase.setup]
 nixPkgs = ['...', 'rustup']
 cmds = ['cargo install cryo_cli']

2 years ago

I've updates this, but I still don't see the commands being applied.


2 years ago

where are you looking?


2 years ago

here

1309043904284463144


2 years ago

where have you placed the nixpacks.toml file within your repo?


2 years ago

My structure looks something like this

/apps
/packages
/tooling

The nixpacks.toml file is in /apps/indexer/nixpacks.toml


2 years ago

since its not at the root you need to tell nixpacks where it is, that can be done with a NIXPACKS_CONFIG_FILE variable


2 years ago

I tried setting it up through a railway.json file

{
  "$schema": "https://railway.com/railway.schema.json",
  "build": {
    "builder": "NIXPACKS",
    "nixpacksConfigPath": "/apps/indexer/nixpacks.toml",
    "buildCommand": "pnpm build --filter indexer",
    "watchPatterns": ["/apps/indexer/**"]
  },
  "deploy": {
    "startCommand": "pnpm start --filter indexer"
  }
}

2 years ago

where did you place the railway.json file


2 years ago

same path

apps/indexer/railway.json


2 years ago

since its not at the root you need to tell railway where it is, that can be done by setting the config path in the service settings


2 years ago

I can tell it's being used, I already set up the path

1309045073127669820


2 years ago

try this


2 years ago

on it


2 years ago

not sure it's working

1309045625412780063


2 years ago

This is the value I gave the variable

/apps/indexer/nixpacks.toml


2 years ago

oh shit its phases not phase


2 years ago

<:kek:885396556520493056>


2 years ago

damn typos


2 years ago

pushed the changes, will report back


2 years ago

they seem to be working now <:pog:925010410518749194>

1309045986366324736


2 years ago

In the future, would it be better just to set it up through env vars?


2 years ago

Or the approach I took was fine?


2 years ago

it was likely fine yeah lol


2 years ago

thanks you!


2 years ago

does the deploy work?


2 years ago

I'm having some issues with rustup, but I think that's a skill issue on my end


2 years ago

i wish you all the best (i dont know rust)


2 years ago

me neither <:harold:906670492818235473>


2 years ago

oof


lucasgarcia98
HOBBY

2 years ago

you can use the variables from nixpacks to install packages

like this:

NIXPACKS_PKGS="rustup"


lucasgarcia98
HOBBY

2 years ago

do you can see more in this link:

https://nixpacks.com/docs/configuration/environment


2 years ago

I've seen, this package comes with cargo unconfigured.


lucasgarcia98
HOBBY

2 years ago

maybe you can install cargo package too


lucasgarcia98
HOBBY

2 years ago

like this:

NIXPACKS_PKGS="rustup cargo"


2 years ago

I was able to get it working by installing rustup manually, it's fine


Off topic, but new role applied helping out 🙂


Welcome!

Sign in to your Railway account to join the conversation.

Loading...