Is there a way to pass an extra flag to the `install` command?

Is there a way in Nixpacks to pass an extra flag? For example, I would like to skip the postInstall when running pnpm install and add the --ignore-scripts flag. Is there a way to do that in railway.toml?
17 Replies
Percy
Percy2y ago
Project ID: 660f85e6-f8fa-467e-8c57-d93f8eb3304e
Ryan The Temp
Ryan The TempOP2y ago
660f85e6-f8fa-467e-8c57-d93f8eb3304e
Brody
Brody2y ago
to give me a better idea of what currently happens show me the table at the top of the build logs
Ryan The Temp
Ryan The TempOP2y ago
What happens is, in a monorepo, a build will fail in a situation like this: Project A - ENV: a,b Project B - ENV: c The postinstall script will run all the time for every project in the monorepo. If the postinstall script expect env a,b then Project B will always fail during the postinstall phase.
Ryan The Temp
Ryan The TempOP2y ago
Ryan The Temp
Ryan The TempOP2y ago
I'd like to add after --frozen-lockfile the flag --ignore-scripts
Brody
Brody2y ago
yeah we can do that
Ryan The Temp
Ryan The TempOP2y ago
how?
Brody
Brody2y ago
not at my computer at the moment unfortunately can you provide me with your current railway.json file, if you dont have one in your project you can find it in the details tab of your latest deployment
Ryan The Temp
Ryan The TempOP2y ago
This is the toml file at the moment:
[build]
builder = "nixpacks"
buildCommand = "pnpm directus:build-extensions"
watchPatterns = ["apps/directus/**", "pnpm-lock.yaml", "directus-extensions/**"]

[deploy]
startCommand = "pnpm directus:apply-schema && pnpm directus:start"
restartPolicyType = "on_failure"
restartPolicyMaxRetries = 5
[build]
builder = "nixpacks"
buildCommand = "pnpm directus:build-extensions"
watchPatterns = ["apps/directus/**", "pnpm-lock.yaml", "directus-extensions/**"]

[deploy]
startCommand = "pnpm directus:apply-schema && pnpm directus:start"
restartPolicyType = "on_failure"
restartPolicyMaxRetries = 5
Brody
Brody2y ago
did you have that as a file in your project @Ryan the Temp
Ryan The Temp
Ryan The TempOP2y ago
yes
Brody
Brody2y ago
well i only know how to do this with railway.json, so i hope you dont have an attachment to toml
Ryan The Temp
Ryan The TempOP2y ago
I can try json
Brody
Brody2y ago
im doing that for you delete your railway.toml file and use this railway.json file instead
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "pnpm directus:build-extensions",
"watchPatterns": ["apps/directus/**", "pnpm-lock.yaml", "directus-extensions/**"],
"nixpacksPlan": {
"phases": {
"install": {
"cmds": ["npm install -g corepack", "corepack enable pnpm i --frozen-lockfile --ignore-scripts"]
}
}
}
},
"deploy": {
"startCommand": "pnpm directus:apply-schema && pnpm directus:start",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 5
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "pnpm directus:build-extensions",
"watchPatterns": ["apps/directus/**", "pnpm-lock.yaml", "directus-extensions/**"],
"nixpacksPlan": {
"phases": {
"install": {
"cmds": ["npm install -g corepack", "corepack enable pnpm i --frozen-lockfile --ignore-scripts"]
}
}
}
},
"deploy": {
"startCommand": "pnpm directus:apply-schema && pnpm directus:start",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 5
}
}
Ryan The Temp
Ryan The TempOP2y ago
oh ok, I see. thx I'll try that
Brody
Brody2y ago
yeah just check the build table to make sure the command is what you want and if everything is in the right order think it goes without saying, but the railway.json i provided was untested by me let me know how it goes
Want results from more Discord servers?
Add your server