Rust project fails to build

During the build I get the error cargo: command not found. In my nixpacks.toml file rust is given as the provider. Tried to redeploy but it doesn't seem to be working.
Solution:
well that means it's time to move to a Dockerfile
Jump to solution
27 Replies
Percy
Percy6mo ago
Project ID: 17da20a5-39a3-45c4-9dc5-073cd4c32640
SnailMan
SnailManOP6mo ago
17da20a5-39a3-45c4-9dc5-073cd4c32640
SnailMan
SnailManOP6mo ago
Here are the build logs
Brody
Brody6mo ago
please share the nixpacks.toml file
SnailMan
SnailManOP6mo ago
providers = ["rust"]

[phases.setup]
nixPkgs = ["ffmpeg"]
providers = ["rust"]

[phases.setup]
nixPkgs = ["ffmpeg"]
Brody
Brody6mo ago
what does the providers option in your service settings say? if it doesnt include rust make sure to add it
SnailMan
SnailManOP6mo ago
it shows rust as the provider in the settings
SnailMan
SnailManOP6mo ago
it knows that it needs to use cargo
No description
Brody
Brody6mo ago
try deploying into a new service
SnailMan
SnailManOP6mo ago
It had everything cached and instantly failed due to the same error
Brody
Brody6mo ago
try deploying into a new different service
SnailMan
SnailManOP6mo ago
Thats what I did, I made an another service from the same repo.
Brody
Brody6mo ago
is rust selected in the providers list in the service settings?
SnailMan
SnailManOP6mo ago
Yes it is
Brody
Brody6mo ago
can you temporarily remove your nixpacks.toml file?
SnailMan
SnailManOP6mo ago
Removed the file and it deployed successfully
Brody
Brody6mo ago
let's see the build table now?
SnailMan
SnailManOP6mo ago
No description
SnailMan
SnailManOP6mo ago
Now it includes the compilers
Brody
Brody6mo ago
now use this nixpacks.toml file instead -
[phases.setup]
nixPkgs = ["...", "ffmpeg"]
[phases.setup]
nixPkgs = ["...", "ffmpeg"]
SnailMan
SnailManOP6mo ago
Oh, I somehow missed it in the docs that without the ... it discards the auto-detected packages Ok, it deployed with ffmpeg Thanks for the help!
Brody
Brody6mo ago
hey I missed that too when you sent it
SnailMan
SnailManOP6mo ago
Okay apparently this is not the end of my issues... I can see in the logs that ffmpeg being installed, but I guess the binary is not in the PATH? My code can't spawn the ffmpeg process, it says that there is no such file. For testing I tried to run a which ffmpeg but it doesn't return anything. Tried installing it via aptPkgs instead of nixPkgs but the issue still persists.
Solution
Brody
Brody6mo ago
well that means it's time to move to a Dockerfile
Brody
Brody6mo ago
And don't say you don't know how, if you know rust you can figure out a Dockerfile
SnailMan
SnailManOP6mo ago
I'll try to cook up something then, thanks for the idea Got my Dockerfile up and running and everything seems to work, including the ffmpeg. Thanks once again.
Brody
Brody6mo ago
I keep telling everyone, Dockerfile is the way to go, glad it worked for you too!
Want results from more Discord servers?
Add your server