Install a binary during set up process

a year 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']

39 Replies

a year ago

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


a year ago

but I'm not even sure it's being used
does the build table show you the commands youve set?


a year ago

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

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

a year ago

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


a year ago

where are you looking?


a year ago

here

1309043904284463000


a year ago

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


a year ago

My structure looks something like this

/apps
/packages
/tooling

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


a year 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


a year 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"
  }
}

a year ago

where did you place the railway.json file


a year ago

same path
apps/indexer/railway.json


a year 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


a year ago

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

1309045073127669800


a year ago

try this


a year ago

on it


a year ago

not sure it's working

1309045625412780000


a year ago

This is the value I gave the variable
/apps/indexer/nixpacks.toml


a year ago

oh shit its phases not phase


a year ago

<:kek:885396556520493056>


a year ago

damn typos


a year ago

pushed the changes, will report back


a year ago

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

1309045986366324700


a year ago

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


a year ago

Or the approach I took was fine?


a year ago

it was likely fine yeah lol


a year ago

thanks you!


a year ago

does the deploy work?


a year ago

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


a year ago

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


a year ago

me neither <:harold:906670492818235473>


a year ago

oof


lucasgarcia98
HOBBY

a year ago

you can use the variables from nixpacks to install packages
like this:
NIXPACKS_PKGS="rustup"


lucasgarcia98
HOBBY

a year ago

do you can see more in this link:
https://nixpacks.com/docs/configuration/environment


a year ago

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


lucasgarcia98
HOBBY

a year ago

maybe you can install cargo package too


lucasgarcia98
HOBBY

a year ago

like this:
NIXPACKS_PKGS="rustup cargo"


a year ago

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


Off topic, but new role applied helping out 🙂


Loading...