Pure build rust

I setup manifest of my rust project as shown in example repo

But when I build it in pure mode, I am getting error:
Cargo.yaml is not present in /build/myproject-pure-0.1.0

After some digging around I saw that there is default.nix in the .flox/pkgs dir in the example repo. So I added it in my project and now it’s magically working. (even though I never called the nix expression)

After some debugging I found that before adding default.nix, source files were not present in the /build directory but after adding nix expression, they are

Is adding default.nix mandatory? If I don’t want it, should I manually copy source files?

My project manifest is exactly the same as example repo

The default.nix shouldn’t be necessary to build the manifest packages.

Pure builds require your sources to be tracked by git, just like nix builds. Is it possible that by adding the nix build you also git added your sources for the first time?

If you can reproduce this while trackings sources files and after removing the default.nix I’m suspecting a bug that we’d need to look into further.

That’s it!

default.nix makes you add all files to git that’s why it was working

To verify, I removed all files from git and tried to build in pure mode it was failing again.

Is it mentioned somewhere in docs that files needs to be git tracked for pure build?

Many thanks for your help

Glad that solved it!

It is mentioned in the docs but it could be bit clearer so I’ve raised a PR to update it. Feel free to comment there if you have any more specific suggestions that would have helped you: docs(builds): Clarify git for pure manifest builds by dcarley · Pull Request #424 · flox/floxdocs · GitHub

1 Like